Hello sir/ maam. I got the original purpose of this practice problem, that there are 6 names which appear more than or equal to 100000, but however what if i want to print those names, i tried this code but its not working, i tried solving it but i am not successful. It would be great if someone helps. Thanks a lot
Screen Link:
My Code:
import csv
file = open('dq_unisex_names.csv')
reader = csv.reader(file)
rows = list(reader)
names = []
for row in rows[1:]:
name = str(row[0])
if name >= 100000:
names.append(name)
print(names)
What I expected to happen: To get the names of the 6 people who are >=100000 times in the file.
What actually happened:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-c1d47aaf23cc> in <module>
7 for row in rows[1:]:
8 name = str(row[0])
----> 9 if name >= 100000:
10 names.append(name)
11
TypeError: '>=' not supported between instances of 'str' and 'int'