14. 99 Problems but a switch ain't one HELP


#1

Here is my code, do you know what's
wrong with it? Thanks!! Urgent reply wld be good.

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

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


#2

Did you forget to put the "answer" into the if, elif and else.
I think you didn't put that. It would be like this: "if answer > 5:"
and here's my suggestion 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)


#3

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