Python I have incorrect output and I need help to fix my code. This…
Question Answered step-by-step Python I have incorrect output and I need help to fix my code. This… PythonI have incorrect output and I need help to fix my code.This is what I have now :Total number of World Series games: 112nNumber of World Series champions: 29nThe team that won most World Series games:nNew York YankeesnNew York Yankees won 27 times.nThis is what I need:Total number of World Series games: 112nNumber of World Series champions: 29nThe team that won most World Series games: New York Yankeesn.New York Yankees won 27 times.n*Line numbers 3 and 4 should be in one line.winner = {}series = 0with open(“WorldSeriesWinners.txt”) as fil: for line in fil: series = series + 1 line = line.strip(‘n’) if line in winner: winner[line] = winner[line] + 1 else: winner[line] = 1count_of_champions = len(winner)values = winner.values()maximum = max(values)winner_team = “”print (“Total number of World Series games:”,series)print (“Number of World Series champions:”,count_of_champions)print (“The team that won most World Series games:”)for key in winner.keys(): if(winner[key] == maximum): winner_team = key print (key)print (winner_team,”won”, maximum, “times.”) Computer Science Engineering & Technology Python Programming Share QuestionEmailCopy link Comments (0)


