The program illustrates the use of conditional statements.
Conditional statements are statements whose execution depends on the truth value of the condition.
The program in Python, where comments are used to explain each line is as follows:
#This defines the GPAcalc function
def GPAcalc(grade):
#This converts grade to lower case
grade = grade.lower()
#The following if conditions returns the GPA value depending on the letter grade
if grade == "a":
return 4
elif grade == "b":
return 3
elif grade == "c":
return 2
elif grade == "d":
return 1
elif grade == "f":
return 0
#If the letter grade is Invalid, then the function returns Invalid
else:
return "Invalid"
#This gets input for grade
grade = input("Letter Grade: ")
#This prints the corresponding GPA value
print("GPA value:",GPAcalc(grade))
At the end of the program, the corresponding GPA value is printed
Read more about similar program at:
https://brainly.com/question/20318287