Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grades ={"A+": 4.2, "A": 4.0, "A-": 3.9, "B+": 3.7,"B": 3.2, "B-": 3.0, "C+": 2.8,"C": 2.2, "C-": 2.0, "D+": 1.8,"D":1.2,"F":0}
- check = True
- total_count = 0
- total_point = 0
- while check:
- check2 = True
- count = 0
- point = 0
- while check2:
- letter = input("Please enter the grade: ")
- if letter == "quit":
- check = False
- break
- if letter == "":
- break
- if letter in grades:
- point += grades[letter]
- count += 1
- else:
- print("Invalid Grade!!!")
- if point != 0:
- gpa = point/count
- print(f'The GPA is {gpa}')
- elif point == 0:
- print("No GPA calculated")
- total_count += count
- total_point += point
- if total_point != 0:
- overall_avg = total_point/total_count
- print(f'The Overall average is {round(overall_avg,3)}')
- else:
- print("No Overall average calculated")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement