CBSE · 083Class XII · 2025Section D2 marks
Question 33ii
4 March 2025 · Computer Science (083)
(ii) Write a function count_rec() which counts and returns the number of records in the file.
Answer
python
def count_rec():
with open("P_record.csv","r") as F:
Records=list(csv.reader(F))
print(len(Records))Explanation
Reads all rows into a list and returns its length.