Please help me correct the code. Baseball_data.txt: (convert the…

Question Answered step-by-step Please help me correct the code. Baseball_data.txt: (convert the… Please help me correct the code.Baseball_data.txt: (convert the link below into .txt file to use)https://docs.google.com/document/d/1BqpQfplHDqq_M17842UNL22Bvyq1bG8tXIJSS8gsNNY/edit?usp=sharing draw = ‘drawing’A = ”|Team Name|Winning|Loss|Drawing|Winning Rate|Average Points|Average Conquest|”class Competitor:   winning = 0   loss = 0   number_of_wins = 0   number_of_losses = 0   number_of_draws = 0   total = 0   used = False   def println(self):      print(‘|%s|%d|%d|%d|%.3f|%.2f|%.2f|’.format(self.Team_name, self.number_of_wins, self.number_of_losses, self.number_of_draws, self.win_rate,                                              self.Average_Points, self.Average_Conquest))B = open(‘baseball_data.txt’,’r’,encoding=’utf-8′)Teams = {}while True:   line = B.readline()   if line == ”:       break   row = line.split(‘,’)   Home = row[1]   Away = row[2]   winning = int(row[3])   loss = int(row[4])   winner = row[5].strip(‘n’)   if Home not in Teams:       Teams[Home] = Competitor()       Teams[Home].name = Home   Teams[Home].winning += winning   Teams[Home].loss += loss          if Away not in Teams:       Teams[Away] = Competitor()       Teams[Away].name = Away   Teams[Away].winning += loss   Teams[Away].loss += winning   if draw == winner.strip(‘n’):       Teams[Away].number_of_draws += 1       Teams[Home].number_of_draws += 1   elif winner == Home:       Teams[Home].number_of_wins += 1       Teams[Away].number_of_losses += 1   else:       Teams[Home].number_of_losses += 1       Teams[Away].number_of_wins += 1              Teams[Home].total += 1   Teams[Away].total += 1B.close()       for i in Teams.values():   i.Average_Points = t.winning / t.total   i.Average_Conquest = t.loss / t.total   i.win_rate = t.number_of_wins / (t.total – t.number_of_wins)sort_Teams = []  while True:   use = False   max = None   for i in Teams.values():       if not i.used:           use = True           if max is None:               max = i           elif max.win_rate < i.win_rate:               max = i   if not use:       break   max.used = True   sort_Teams.append(max)print(A)for i in sort_Teams:   t.println() Image transcription textPYTHON: Baseball Data *** Assignment Objective: To learnhow to open files and process data using complex data typesand control statements. *** Assignment: Write a pr... Show more... Show moreImage transcription text* * * * Note: Since the top two teamshave the same win rate in the finalresult, the order of the 1st... Show more... Show moreBaseball_data.txt: (convert the link below into .txt file to use)https://docs.google.com/document/d/1BqpQfplHDqq_M17842UNL22Bvyq1bG8tXIJSS8gsNNY/edit?usp=sharing Computer Science Engineering & Technology Software engineering COMPUTER 123 Share QuestionEmailCopy link Comments (0)