Question: PYTHON This program will store and edit the roster and rating information for a soccer team. Similar to how coaches rate players during tryouts to
PYTHON This program will store and edit the roster and rating information for a soccer team. Similar to how coaches rate players during tryouts to ensure a balanced team.
(1) Prompt the user to enter jersey number (0-99) and rating (1-9) for 5 players. Store the jersey numbers and the ratings in the form of a dictionary. Print the dictionary's elements with the jersey numbers in ascending order (i.e., print the roster from smallest to largest jersey number).
Hint: Dictionary keys can be stored in a sorted list. For example:
Enter player 1's jersey number: 84 Enter player 1's rating: 7
Enter player 2's jersey number: 23 Enter player 2's rating: 4
Enter player 3's jersey number: 4 Enter player 3's rating: 5
Enter player 4's jersey number: 30 Enter player 4's rating: 2
Enter player 5's jersey number: 66 Enter player 5's rating:
9 ROSTER Jersey number: 4, Rating: 5 Jersey number: 23, Rating: 4 Jersey number 30, Rating: 2 ...
(2) Implement a menu of options for a user to modify the roster. Each option is represented by a single character. The program initially prints the menu and the program only ends when the user chooses the option to Quit.
For example:
MENU
a - Add player.
d - Remove player.
u - Update player rating
r List players above a certain rating
o - Print roster
q - Quit.
Choose an option:
(3) For "Add player" menu option, prompt the user for a new player's jersey number and rating. Append the values in the dictionary.
For example:
Enter a new player's jersey number: 49 Enter the player's rating: 8
(4) For "Remove player" menu option, prompt the user for a player's jersey number. Remove that player from the roster (remove both jersey number and rating).
For example:
Enter a jersey number: 4
(5) For "Update player rating" menu option, prompt the user for a player's jersey number. Prompt again for a new rating for that player, and then change that player's rating.
For example:
Enter a jersey number:
23
Enter a new rating for player:
6
(6) For "List players above a certain rating" menu option, prompt the user for a rating. Print the jersey number and rating of all the players above that specific rating.
For example:
Enter a rating: 5 Players with rating above 5 Jersey number: 66, Rating: 9 Jersey number: 84, Rating: 7 ... (7) For "Print roster" menu option, print the updated roster. For example: ROSTER Jersey number: 4, Rating: 5 Jersey number: 23, Rating: 4 Jersey number 30, Rating: 2 ...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
