Sending a Letter - Oops, try again. get_letter_grade seems to be missing


#1

Please tell me where I am wrong in the below code

    def get_letter_grade(score):
        if score>=90:
            return "A"
        elif 90>score>=80:
            return "B"
        elif 90>score>=70:
            return "C"
        elif 70>score>=60:
            return "D"
        else:
            return "F"
        return 
        print get_letter_grade(get_average(lloyd))

It is throwing error Oops, try again. get_letter_grade seems to be missing.


#2

Seems like an extra return statement snuck in there and is not needed. Try taking it out and see what happens!


#3

this:

elif 90>score>=80:

is a bit weird, when the if condition is true, elif will not run. So all you need to do for letter_grade B is to check that score is greater then 80

if you want multiply comparison, do it nicely and use and

same for the other elif's plus @bibleman13 point

Plus, the function call should be outside/after the function content


#4

Still the same error even after modifying according to @bibleman13 and @stetim94

def get_letter_grade(score):
    if score == int or float:
        if score>=90:
            return "A"
        elif 90>score and score>=80:
            return "B"
        elif 90>score and score >=70:
            return "C"
        elif 70>score and score >=60:
            return "D"
        else:
           return "F"
         
print get_letter_grade(get_average(lloyd))

#5

okay, is your get_letter_grade after your get_average function? Not nested inside?

Can i see your full code?


#6

Made a change, works well now. Thanks @stetim94 :slight_smile:


#7