You've got a couple of issues:
First reader
is empty at this point, since you've already looped over its elements. Reading from a file is a one-time deal, if you want to access its contents more than once you need to write it to a data structure, e.g.:
rows = []
with open("student.csv", newline='') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
rows.append(row)
However this also won't be sufficient, because rows
is now a 2D list, as each row
the reader returns is itself a list. An easy way to search for a value in nested lists is with list comprehensions:
if studentToFind in [cell for row in rows for cell in row]:
print('yes')
else:
print('no')
Put it together, so the indentation's easier to see:
rows = []
with open("student.csv", newline='') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
rows.append(row)
if studentToFind in [cell for row in rows for cell in row]:
print('yes')
else:
print('no')