Question: Improve the program Use the skills you learned in section 2 to improve this program. This should improve the appearance of the console and the
Improve the program
Use the skills you learned in section 2 to improve this program. This should improve the appearance of the console and the readability of the code.
Console
| Baseball Team Manager | |
| CURRENT DATE: | 2021-03-19 |
| GAME DATE: | 2021-03-21 |
| DAYS UNTIL GAME: 2 | |
| MENU OPTIONS | |
| 1 - Display lineup | |
| 2- Add player | |
| 3- Remove player | |
| 4-Move player | |
| 5- Edit player position | |
| 6- Edit player stats | |
| 7 - Exit program |
POSITIONS
C, 1B, 2B,3B, SS, LF, CF, RF, P
| Menu option: 1 Player | POS | AB | AVG |
| 1 Tommy La Stella | 3 | 1316 | 0.274 |
| 2 Mike Yastrzemski | RF | 563 | 0.298 |
| 3 Donovan Solano | 2B | 1473 |
0.276 |
| 4 Buster Posey | C | 4575 |
0:302 |
| 5 Brandon Belt | 1B | 3811 |
0.263 |
| 6 Brandon Crawford | SS | 4402 |
0.250 |
| 7 Alex Dickerson | LF | 586 |
0.273 |
| 8 Austin Slater | CF | 569 |
0.258 |
| 9 Kevin Gausman | P | 56 |
0.036 |
Menu option: 1
Player -H
| 1 Tommy La Stella - 360 |
| 2 Mike Yastrzemski- 168 |
| 3 Donovan Solano - 407 |
| 4 Buster Posey- 1380 |
| 5 Brandon Belt- 1003 |
| 6 Brandon Crawford- 1099 |
| 7 Alex Dickerson- 160 |
| 8 Austin Slater- 147 |
| 9 Kevin Gausman- 2 |
Specifications
- Use the repetition operator to display separator lines that use 64 characters.
- Use spaces, not tabs, to align the columns of data for the players.
- Make sure the program always displays the batting average with 3 decimal places.
- Display the positions by processing the tuple of valid positions.
- When the program starts, use the YYYY-MM-DD format to display the current date and to get the date of the next game from the user.
- Make sure the user enters the date in the correct format.
- Only display the number of days until the game if the game is in the future. Don't display the number if the game date is in the past or the user doesn't enter a date.
- Use a dictionary to store the data for each player. To get this to work, you need to modify the functions that read and write the data to the file so they work correctly with a list of dictionaries. That's because the previous version of this program used the csv module to work with a list of lists, but the csv module doesn't work with a list of dictionaries.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
