8.19 LAB*: Program: Soccer team roster (Dictionaries) This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers and the ratings in a dictionary. Output the dictionary's elements with the jersey numbers in ascending order (i.e., output the roster from smallest to largest jersey number). Hint:

Respuesta :

roster = {}

for x in range(5):

   jersey = int(input('Enter a jersey number: '))

   rating = input('Enter the player\'s rating: ')

   roster[jersey] = rating

print('Smallest to largest jersey number with player rating: ')

for x in sorted(roster):

   print('Jersey number: '+str(x),'Player rating: '+roster[x])

I wrote my code in python 3.8. I hope this helps.

The program is an illustration of loops

Loops are used to perform repetitive operations.

The program in Python, where comments are used to explain each line is as follows:

#This initializes the dictionary

mydict = {}

#This following loop is repeated 5 times

for i in range(5):

   #This gets the jersey number

   nums = int(input('Jersey number (0 - 99): '))

   #This gets the player ratings

   rating = input('Rating (0 - 9): ')

   #This populates the dictionary

   mydict[nums] = rating

#This prints the output header    

print('Jersey Number\tPlayer Rating: ')

#This iterates through the sorted dictionary

for i in sorted(mydict):

   #This prints the jersey number and the player rating

   print(str(i),'\t\t',mydict[i])

At the end of the program, the jersey number and the player ratings are printed.

Read more about similar programs at:

https://brainly.com/question/14447914