I got 99 Problems... pls help


#1

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)

I'm not sure whether this is right but it comes up with "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!" and I'm not sure what this means. could someone help out


#2

in the if and elif condition, why is answer a string in your case? I would use the function parameter


#3

The issue is the Quotes you have on the word answer ...(Do not include the Quotes)

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)


#4

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