1. Repeatedly ask the user to enter a team name and how many games the team has won and how many they lost. Store this information in a dictionary where the keys are the team names and the values are lists of the form [wins, losses].

(a) Using the dictionary created above, allow the user to enter a team name and print out the team’s
winning percentage.
(b) Using the dictionary, create a list whose entries are the number of wins of each team.
(c) Using the dictionary, create a list of all those teams that have winning records.

# Code
n = int(input(‘Enter number of teams : ‘))
scores = {}
for i in range(n):
name = input(‘Enter team name : ‘)
w = int(input(‘Enter wins : ‘))
l = int(input(‘Enter losses : ‘))
scores[name] = [w, l]

# (a)
t = input(‘Enter team name : ‘)
print(‘winning percentage of’, t, ‘is’, (scores[t][0]/sum(scores[t]))*100)

# (b)
w_team = [i[0] for i in scores.values()]
print(w_team)

# (c)
w_rec = []
for i in scores:
if scores[i][0] > 0:
w_rec.append(i)
print(w_rec)