14.I Got 99 Problems


#1

Can somebody explain me this because i dont get it.
This is one of my tries:
def greater_less_equal_5(answer):
if 8>5:
return 1
elif 8<5:
return -1
else:
return 0

print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)
This is error i get:
Oops, try again. It looks like your function output 1 instead of -1 when answer is 3. Make sure you filled in the if and elif statements correctly!


#2

Where is the 8 coming from? Are we not expected to use the argument, answer?


#3

This wont work either
def greater_less_equal_5(answer):
if "greater then 5":
return 1
elif "less than 5":
return -1
else:
return 0


#4

The argument is answer so use that variable in your comparisons.

if ______ > 5:

and so on.


#5

if/elif statements must always have a mathematical equation, =,<,>, etc...

And also check this... looks wrong to me... I might be wrong though!
:wink: :wink: :wink:


#6

The math term is inequality, but does not include =, that is for assignment. Comparison operators include,

==
<=
>=
!=
<
>

Seems you are. There is nothing wrong with those three lines.


#8