I am new to programming and I need help finding how many times the user input occurs inside of a txt file. The code I currently have is:
myfile = open("WorldSeriesWinners.txt")
count = 0
team = input("Enter in the team name that won the world series: ")
line = myfile.readline()
myfile.readline()
while team in line:
count += 1
myfile.readline()
print("The", team, "won the world series", count, "times")
myfile.close()
The output I get from this is:
Enter in the team name that won the world series: New York Yankees
The New York Yankees won the world series 0 times
How would I get it to show many times a specific team won? Thanks in advance.