I Got 99 Problems, But a Switch Ain't One


#1



I Got 99 Problems, But a Switch Ain't One


it should be right, but for some reason its not. what am i doing wrong?


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


#2

look at this function calls:

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

for each of this function call, is the correct number (1, 0 or -1) returned? No, your function always return -1, regardless of the argument you supply at function call


#4

the problem is you have to use de var. "answer" and not some numbers to compare

so it would look like this:

if answer>5

and

elif answer<5


#5

Me too. It's not math stupidity. It's an Abbot and Costello Who's on first.
It doesn't reference by parts. The instructions are mashed potatoes.


#6

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