'99 problems but a switch ain't one' code problem


#1

Hi,
I'm a beginner when it comes to using python and I have a problem when it comes to the test calles '99 problems but a switch ain't one'
I use the code:

def greater_less_equal_5(answer):
 if answer > 5:
    return 1
    
  elif answer < 5:         
    return -1
  else:
    return 0

        
print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)

And the response is :

File "python", line 5
elif answer < 5:
^
IndentationError: unindent does not match any outer indentation level

I totally don't know what the problem is in this case so if any of y'all could help that would be great!


#4

If we examine your code, we can see that the elif and else have two spaces of indentation, but if only has one. These all three must match.

if

elif

else

#5

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