Question: A_MIN_SCORE = 90 B_MIN_SCORE = 80 C_MIN_SCORE = 70 D_MIN_SCORE = 60 # else F # example with printing and nested if def getLetterGradeNestedIf(num_score): if

A_MIN_SCORE = 90
B_MIN_SCORE = 80
C_MIN_SCORE = 70
D_MIN_SCORE = 60 # else F

# example with printing and nested if
def getLetterGradeNestedIf(num_score):
if num_score >= A_MIN_SCORE:
print("grade is A")
else:
if num_score >= B_MIN_SCORE:
print("grade is B")
else:
if num_score >= C_MIN_SCORE:
print("grade is C")
else:
if num_score >= D_MIN_SCORE:
print("grade is D")
else:
print("grade is F")
# example of elif and example of variable to store the score
def getLetterGrade_elif(num_score):
letter_grade = ""
if num_score >= A_MIN_SCORE:
letter_grade = "A"
elif num_score >= B_MIN_SCORE:
letter_grade = "B"
elif num_score >= C_MIN_SCORE:
letter_grade = "C"
elif num_score >= D_MIN_SCORE:
letter_grade = "D"
else:
letter_grade = "F"
return(letter_grade)


numerical_score = int(input("enter numerical grade: "))
print("nested if")
getLetterGradeNestedIf( numerical_score)
print("elif")
print("grade is " + getLetterGrade_elif(numerical_score)) # one way

# another way
result = getLetterGrade_elif(numerical_score)
print("grade is", result)

Choose one of the functions to modify it and create a program that takes the numerical grade as float and that allows B+ and C+.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!