369,359 views
31 votes
31 votes
7.4 code practice question 1 edhesive

User Ravi Parekh
by
2.1k points

2 Answers

15 votes
15 votes

Answer:

7.4 Code Practice: Question 1

def GPAcalc(g):

if g == "a" or g == "A":

return 4

elif g == "B" or g == "b":

return 3

elif g == "C" or g == "c":

return 2

elif g == "D" or g == "d":

return 1

elif g == "F" or g == "f":

return 0

Step-by-step explanation:

User Mayuran
by
3.6k points
22 votes
22 votes

Answer:

def GPAcalc(letterG):

if "a" in letterG.lower():

return 4

elif "b" in letterG.lower():

return 3

elif "c" in letterG.lower():

return 2

elif "d" in letterG.lower():

return 1

elif "f" in letterG.lower():

return 0

else:

return("Invalid")

letterGrade = input("Enter your Letter Grade: ")

grade = GPAcalc(letterGrade)

print("Your GPA score is: " + str(grade))

Step-by-step explanation:

yuh yuh

User DonnaLea
by
3.1k points