我正在进行编程练习。总的来说,当有人输入球队名称时,它将显示该球队赢得世界大赛的次数。它从读取的文件中提取此信息。问题是,当我运行代码时,不会显示任何错误,但是在运行代码时它不会显示任何内容。我的问题是,我的打印功能或主要功能缺少什么?为什么我的代码运行时什么也没显示?我的代码在下面。
def team_from_file(file_name):
readfile = open(file_name, 'r')
team_list = []
team = readfile.readline()
while team != ' ':
team_list.append(team)
team = readfile.readline()
return team_list
def times_won(user_team_name, list_of_winning_teams):
winning_times = 0
for current_win in range(len(list_of_winning_teams)):
if list_of_winning_teams [current_win] == user_team_name:
winning_times = winning_teams + 1
return winning_teams
def print_times_won(winning_team_name, winning_times):
print(winning_team_name, 'has won the World Series', winning_times)
def main():
file_name = "WorldSeriesWinners.txt"
win_team_list = team_from_file(file_name)
user_input = input('Please enter team name: ')
winning_times = times_won(user_input, win_team_list)
print_times_won( print_times_won, winning_times )
main()