Question: Create a separate Python program to save the following player statistics for the home baseball team: Player First and Last Name character string Games Played

Create a separate Python program to save the following player statistics for
the home baseball team:
Player First and Last Name
character string
Games Played
non
-
negative integer
Home Runs
non
-
negative integer
Batting Average
floating point between
0
.
0
and
1
.
0
Prompt and read the above data for a user defined number of players.
Include validation during entry and write the validated data out to a user
defined sequential ASCII text file. Include the following problem
requirements in your program for maximum points:
Include a multi
-
line program comment header that includes your name,
date, class, and short problem description.
Use a modular approach. Include and use a main function to start the
program, create variables, read input, call any functions, and display
output as required. Use parameters, not global variables, to transfer data
between functions. Include function docstrings for created functions.
Allow user entry of number of players for saving team statistics
Allow user entry of the filename for saving team statistics
Use descriptive prompts when reading player statistics
Include exception handling for file processing and data entry
(
only allow
positive numerical values of the appropriate type and in the appropriate
range
)
.
Use raised exception objects and try
/
except statements for
exception handling with customized error message, not assert statements
or the print function, when performing user input validation during data
entry.
The following types of errors should be handled
(
with custom error
messages and value re
-
entry
)
:
Negative or non
-
integer number of players to record:
Invalid filename:
Negative or non
-
integer number of games played:
Negative or non
-
integer number of home runs:
Negative or non
-
floating point batting average in range of
0
.
0
to
1
.
0
:
Close file when player statistics h Create a separate Python program to save the following player statistics for
the home baseball team:
Player First and Last Name character string
Games Played non-negative integer
Home Runs non-negative integer
Batting Average floating point between 0.0 and 1.0
Prompt and read the above data for a user defined number of players.
Include validation during entry and write the validated data out to a user
defined sequential ASCII text file. Include the following problem
requirements in your program for maximum points:
Include a multi-line program comment header that includes your name,
date, class, and short problem description.
Use a modular approach. Include and use a main function to start the
program, create variables, read input, call any functions, and display
output as required. Use parameters, not global variables, to transfer data
between functions. Include function docstrings for created functions.
Allow user entry of number of players for saving team statistics
Allow user entry of the filename for saving team statistics
Use descriptive prompts when reading player statistics
Include exception handling for file processing and data entry (only allow
positive numerical values of the appropriate type and in the appropriate
range). Use raised exception objects and try/except statements for
exception handling with customized error message, not assert statements
or the print function, when performing user input validation during data
entry.
The following types of errors should be handled (with custom error
messages and value re-entry):
Negative or non-integer number of players to record:
Invalid filename:
Negative or non-integer number of games played:
Negative or non-integer number of home runs:
Negative or non-floating point batting average in range of 0.0 to 1.0:
Close file when player statistics have been saved to file and inform user
that data has been saved to the file.
Include a multi-line program comment footer that includes a sample
run of your program.
Include a copy of your Python source code file and generated data file for
upload, testing, and grading.
2. Create a separate Python program to read the user input filename created
from the previous program, but display only the following player statistics
for the home baseball team in a formatted report:
Include a Player First and Last Name character string
Games Played non-negative integer
Home Runs non-negative integer
Read an indeterminate number of players (single time read process until end
of file) from a data file created in the previous program #1. Using Python fstring formatting, generate a team player report (with column headings)
that includes the above data for each player as well as summary lines that
include the total number of players, the average number of games played,
and the average number of home runs. Include the following problem
requirements in your program:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!