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 0-100), the program will display an error message
and exit the program. We use integer (type int) to store each score.
Grade Conversion Rules:
Rule 1. If the average score is 90 or more the grade is 'A'.
Rule 2. If the average score is 70 or more and less than 90 then check the third test score. If the
third score is 90 or more the grade is 'A' otherwise the grade is 'B'.
Rule 3. If the average score is 50 or more and less than 70 then check the average of the second
and third scores. If the average of the last two scores is 70 or more, the grade is 'C' otherwise it is
a 'D'
Rule 4. If the average score is less than 50 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 .5
or greater, otherwise truncate the fraction by casting to an int.
The algorithm is: Add 0.5 to the average and cast the result to an int.
Example: average =(int)(average +0.5)
average2=(int)(average2+0.5)
*** do not use round() function
*** rounding rule applies to both average calculations (average of 3 scores, average of 2 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 3 test scores and letter grade
Variables test_score1, test_score2, test_score3 int
average (average of 3 test scores) float to int (after rounding)
average2(average of last 2 test scores) float to int (after rounding)
letter_grade str
COSC-1436 Programming Fundamentals I Python
Constants none
Pseudocode 1. Prompt the user to enter each test score.
2. Read each input and store it into variable.
3. Check to see if any test score is out of range. If it is, display error message.
**Do not use sys.exit() to force exiting the program.
4. If all test scores are valid, calculate average, average2 and letter grade. (*** I
leave it for you to complete the calculations according to the rules above.)
5. Display average of 3 test scores and letter grade.
Assignment Instructions:
1. Create a Python script file to perform the above tasks. Name your assignment first_last_a2.py
where first is your first name and last is your last name.
2. Add comments on top of your program to document your code. Include Program description,
your name and date.
3. Use the above pseudocode to help you write Python code.
4. Name your variables clearly and use constants to store fixed information.
5. Make sure your program is easier to read by adding comments and spaces, etc.
6. Submit your python file in Canvas for grading.
7. Your program grade will be based on the following criteria:
a. Program code and output accuracy 70%
b. Following program instructions for required identifiers/assignment file name if there
are any 15%
c. Program documentation 10%
d. Program output display 5%
8. You will receive a 0 if you copy others code or let others copy your code. Please refer to
Academy Integrity in course syllabus.
9. Program output: (Use 93,81,65 as 1
st set of test data
Use 100,90,-60 as 2nd set of test data)
 Input Rule: If user enters an invalid test score (out of

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 Databases Questions!