Question: PYTHON Purpose: Assignment Two continues the MPG calculator, but more. In this assignment you will practice the following in Python: Defining and using functions Using
PYTHON
Purpose:
Assignment Two continues the MPG calculator, but more. In this assignment you will practice the following in Python:
- Defining and using functions
- Using loop to go through a list, do necessary processing
- Handling errors
- Finding out average and highest values
The background
The background information is the same as in Assignment One (below). We will continue working on the grade book.
In ISM , student grade is made of assignments (200 points possible), exams (200 points possible), and project (100 points possible). So total of 500 points possible. We need a program to help students figure out their standing in the course.
First, we would like to input points earned by the student for the three parts. A total is calculated based on the inputs. Based on the percentage, we would assign letter grade. See table below. Percentage is the total points of the student against 500.
| Percentage | Letter grade |
| >=90% | A |
| >=80% | B |
| >=70% | C |
| >=60% | D |
| <60% | E |
The Program
For Assignment Two, a couple of new things we need to do.
- Rewrite the program to create a function that print out corresponding messages based on percentage. The function takes in one parameter (percent) and no return values.
- If the user enters incorrect input (non-numeric-looking input), your program should stop and provide an explanation. You can decide whether integer or float data type is appropriate.
- We have a list of students. They are Eli, John, and Mali. If you like you can make up your own list. Testing data are provided. We would like to go through the list, for each student, we enter information, calculate percentage, and display the letter grade based on their percentage.
| Input | Should produce: |
| Eli, 134, 100, 40 | 54.800000000000004 % E |
| John, 190, 190, 96 | 95.19999999999999 % A |
| Mali, 180, 160, 80 | 84.0 % B |
- At the end, we will show a summary, how many students, average percentage, and highest percentage among the students entered.
Run:
For Eli
Enter points for assignment>134
Enter points for exam>100
Enter points for project>40
54.80 %
the grade is E
For John
Enter points for assignment>190
Enter points for exam>190
Enter points for project>96
95.20 %
The grade is A
For Mali
Enter points for assignment>180
Enter points for exam>160
Enter points for project>80
84.00%
the grade is B
average percent is 78.00 %
The highest percent is 95.19999999999999 %
Thank you for using project by Garrett!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
