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


#1

Hello.
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”
else:
return “F”

print get_letter_grade(get_average(lloyd))

Thank you in advance!


#2

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.


#3

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


#4

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.


#5

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