Welcome to Westonci.ca, the ultimate question and answer platform. Get expert answers to your questions quickly and accurately. Get immediate and reliable answers to your questions from a community of experienced professionals on our platform. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

Please help! Use the function written in the last lesson to calculate a student's GPA. Ask them how many classes they are taking, then ask them to enter the grades for each class and if it is weighted. Your program should then output the averaged GPA including the decimal place. Your main program must call the function. Sample Run HOw many classes are you taking? 7 Enter your Letter Grade: C Is it weighted? (1 = yes) 1 Your GPA Score is: 3 Enter your Letter Grade: D Is it weighted? (1 = yes) 0 Your GPA Score is: 1 Enter your Letter Grade: A Is it weighted? (1 = yes) 1 Your GPA score is: 5 Enter your Letter Grade: B Is it weighted? (1 = yes) 1 Your GPA Score is: 4 Enter your Letter Grade: C Is it weighted? (1 = yes) O Your GPA Score is: 2 Your weighted GPA is a 3.0

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