Answer to Question #228412 in Python for Caleb

Question #228412

Create a program in Python to calculate grade point averages for college students. Grade point averages are calculated by dividing total number of quality points by the total number of earned credit hours. Quality points are grades earned multiplied by the credit hours of a course.  A grade of A is worth 4 points, B is 3 points, C is 2 points, D is 1 point and an F is 0 points. 

Your program should prompt the student to enter their name, total credit hours earned, and total quality points earned.  Calculate the grade point average and display back the student’s name along with their gpa for my example of John Doe. 

Hi John Doe.  Your grade point average is 3.30.   


1
Expert's answer
2021-08-23T01:18:44-0400
name= input("Enter your name: ")
x=float(input("Enter the credit hours you earned: ")) #credit hours earned
y=float(input("Enter the quality points earned: ")) #quality points
z=(y)/(x)
if z>=4 and z<=4.9:
    grade='A'
elif z>=3 and z<=3.9:
    grade='B'
elif z>=2 and z<=2.9:
    grade='C'
elif z>=1 and z<=1.9:
    grade='D'
elif z>=0 and z<=0.9:
    grade='F'
else:
    grade="Invalid grade"
print("Hi",name,".","Your grade point average is", z)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS