Below is the code to compare line two of the file with the input. This only works if there is nothing else in the file, how would I change the code so it still works when the file has many lines of text in.
name = input("Enter name: ")
with open("numbers") as f:
lines = f.readlines() # a list of all the lines
if lines[1] == name: # the second line (0 indexing)