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