Question: Input Rule: If user enters an invalid test score ( out of range 0 - 1 0 0 ) , the program will display an
Input Rule:
If user enters an invalid test score out of range the program will display an error message
and exit the program. We use integer type int to store each score.
Grade Conversion Rules:
Rule If the average score is or more the grade is A
Rule If the average score is or more and less than then check the third test score. If the
third score is or more the grade is A otherwise the grade is B
Rule If the average score is or more and less than then check the average of the second
and third scores. If the average of the last two scores is or more, the grade is C otherwise it is
a D
Rule If the average score is less than then the grade is F
Rounding Rule: Midpoint rounding using casting
The grade average calculation returns a float. Round up to the next int if the fractional part is
or greater, otherwise truncate the fraction by casting to an int.
The algorithm is: Add to the average and cast the result to an int.
Example: average intaverage
averageintaverage
do not use round function
rounding rule applies to both average calculations average of scores, average of scores
To Solve this problem, we can identify IPO and develop the Pseudocode.
Input Three test scores
Processing Calculate the average and convert it to letter grade according to the four
conversion rules
Output Display the average of test scores and letter grade
Variables testscore testscore testscore int
average average of test scores float to int after rounding
averageaverage of last test scores float to int after rounding
lettergrade str
COSC Programming Fundamentals I Python
Constants none
Pseudocode Prompt the user to enter each test score.
Read each input and store it into variable.
Check to see if any test score is out of range. If it is display error message.
Do not use sysexit to force exiting the program.
If all test scores are valid, calculate average, average and letter grade. I
leave it for you to complete the calculations according to the rules above.
Display average of test scores and letter grade.
Assignment Instructions:
Create a Python script file to perform the above tasks. Name your assignment firstlastapy
where first is your first name and last is your last name.
Add comments on top of your program to document your code. Include Program description,
your name and date.
Use the above pseudocode to help you write Python code.
Name your variables clearly and use constants to store fixed information.
Make sure your program is easier to read by adding comments and spaces, etc.
Submit your python file in Canvas for grading.
Your program grade will be based on the following criteria:
a Program code and output accuracy
b Following program instructions for required identifiersassignment file name if there
are any
c Program documentation
d Program output display
You will receive a if you copy others code or let others copy your code. Please refer to
Academy Integrity in course syllabus.
Program output: Use as
st set of test data
Use as nd set of test data
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
