Find the output of the following Python Code. Assume the file data.csv…

PYQ KVS TGT/PGT 2026

Find the output of the following Python Code.
Assume the file data.csv contains the following text exactly:
2026|Feb|Saturday|Sunny

import csv
def CustomReader():
    with open('data.csv', 'r') as F:
        # Using a pipe (|) as a delimiter
        Reader = csv.reader(F, delimiter='|')
        Row = next(Reader)
        # Manipulating the result
        P1 = Row[1]
        P2 = Row[-1]
        # Joining and counting
        print(P1)
        print(P2)
        print("_".join(Row[0:2]))
        print(len(Row))
CustomReader()

Attempted by 66 students.

Sign up free to check your answer

Sign up free

Explore the full course: Kvs Nvs Tier 2 Computer Science

Loading lesson…