(I)
def show():
import csv
f=open("happiness.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
for i in records:
if int(i[1])>5000000:
print(i)
f.close()
(II)
def Count_records():
import csv
f=open("happiness.csv",'r')
records=csv.reader(f)
next(records, None) #To skip the Header row
count=0
for i in records:
count+=1
print(count)
f.close()
Note (for both parts (I) and (II)):
(i) Ignore import csv as it may be considered the part of the complete program, and there is no need to import it in individual functions.
(ii) Ignore next(records, None) as the file may or may not have the Header Row.