Discover a wealth of knowledge at Westonci.ca, where experts provide answers to your most pressing questions. Get detailed and accurate answers to your questions from a community of experts on our comprehensive Q&A platform. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.
Sagot :
We have that the resultant code is mathematically given as
print("Your GPA score is: %.2f" %GPAcalc(grade, resp)) #printout r
sum += GPAcalc(grade, resp)
print("You weighted GPA is a %.2f")
main()
input()
Program Code
Generally the code is given below
if response != 1 and response != 0:
return sys.exit("Invalid")
elif grade=="A" and response==1:
return 5
elif grade=="A" and response==0:
return 4
elif grade=="B" and response==1:
return 4
elif grade=="B" and response==0:
return 3
elif grade=="C" and response==1:
return 3
elif grade=="C" and response==0:
return 2
elif grade=="D" and response==1:
return 2
elif grade=="D" and response==0:
return 1
elif grade=="F" and response==1:
return 1
elif grade=="F" and response==0:
return 0
else:
return sys.exit("Invalid Grade!")
def main():
sum = 0
num_classes = int(input("classes being taken? "))
for x in range(num_classes):
grade = input("Enter your Letter Grade: ") = int(input("Is it weighted? (1 = yes) "))
print("Your GPA score is: %.2f" %GPAcalc(grade, resp)) #printout
sum += GPAcalc(grade, resp)
print("You weighted GPA is a %.2f")
main()
input()
For more information on Coding visit
https://brainly.com/question/950632
Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.