samedi 23 avril 2016

Hello, Having trouble with 99 problems but a switch aignt one

this is what I've input

def greater_less_equal_5(answer): if 6 > 5: return 1 elif 4 < 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 gave me this note

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 this is what came up in the upper right display

1 1 1 None

No matter how I change around the numbers and the >/< I've even tried == and != it still outputs 1 1 1 None

I've searched around for any possible tips and seen others stuck on the same problem as me and when I tried their solves I then get

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)

and the output is

File "python", line 2 if > 5: ^ SyntaxError: invalid syntax

is this test rigged to always output a failed result to make me pay for pro and ask for their help?

and the hint given for this is

Make sure the if and elif statements end with colons :

Your code should look something like:

if EXPRESSION: do something elif OTHER EXPRESSION: do something else: do something

Am I just missing something horribly basic?

Thank you in Advance Zathamiel

Aucun commentaire:

Enregistrer un commentaire