7/9 - What's wrong with the code?


I don’t understand what’s wrong with the code. It keeps giving me this error:

File “python”, line 35
elif score >= 80:
IndentationError: unindent does not match any outer indentation level

This is the 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”
return “F”

print get_letter_grade(get_average(lloyd))

Thank you in advance!


We cannot tell what your indentation looks like but the error indicates a problem with it. Be sure you are using only spaces, and not tabs, and the indents match.


I am using only spaces. I still can’t find anything that would cause an error.


Be sure that all the elif's and the else all line up and have the exact same indentation. Recommend use the typical two or four space indent on each block level.


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