Sending a Letter


#1



I'm on Sending a Letter and my code is being accepted, but nothing is being sent aside from "none." I think I'm supposed to be print a letter grade at this point, but the program is accepting my code so I'm not sure.


I'm not receiving an error message, but nothing is printing. Is there something wrong with my print code?


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


#2

Fixed my own problem! For anyone else running into the issue, here's the fix.


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


#3

Actually I don't think you need to create a new variable. You can just call the function with your print statement like you did in your original code, except you should be calling it outside of the function. My code below worked without having to use a 'result' variable. Happy coding.

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

#4

my code is same as yours, but it still shows an error that says:
Oops, try again. get_letter_grade(100) returned None instead of 'A' as expected.
can you help me out?


#5

It might be better to make your own thread about this. Either way, can you post your code?


#6

finished the exercise. thanks for caring. :slight_smile:


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.