Question: In python language, follow Instructions given below code. High school assignment - pls keep simple def GPAcalc(letterGrade,weighted): letterGrade = letterGrade.lower() if letterGrade=='a': return weighted+4 elif
In python language, follow Instructions given below code. High school assignment - pls keep simple def GPAcalc(letterGrade,weighted):
letterGrade = letterGrade.lower()
if letterGrade=='a':
return weighted+4
elif letterGrade=='b':
return weighted+3
elif letterGrade == 'c':
return weighted+2
elif letterGrade == 'd':
return weighted+1
elif letterGrade == 'f':
return weighted+0
else:
return "Invalid"
def main():
letterGrade = input("Enter your Letter Grade: ") weighted = int(input("Is it weighted? (1 = yes, 0 = no) ")) print("Your GPA score is:",GPAcalc(letterGrade,weighted)) main()
Instructions
Use the function written in the code above to calculate a students 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) 0
Your GPA score is: 2
Enter your Letter Grade: A
Is it weighted? (1 = yes) 0
Your GPA score is: 4
Enter your Letter Grade: C
Is it weighted? (1 = yes) 0
Your GPA score is: 2
Your weighted GPA is a 3.0.
Hint
Make sure to use two functions to incorporate the last lesson and the current onethe GPAcalc() function and a new one.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
