# Greater or less 5

#1

what i missing in this practice?

if ________:
return 1
elif ________:
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 insructios..
Instructions
On line 2, fill in the if statement to check if answer is greater than 5.
On line 4, fill in the elif so that the function outputs -1 if answer is less than 5.
who can help me??

#2

#3

i'm looking for guidance on this problem as well.

#5

Im beginning to worry I wont be able to learn to code. Im finding stuff like the above difficult.

#6

I'm in the same spot, I think simple logical like these may overpass me and I won't be able to learn coding

#7

Can anyone explain the logic for this code?

#8

Don't worry if you don't get this right now! Everyone here will get it with time, practice, and (most importantly) patience. Let's get some things out of the way here:

if ______ > 5:
return 1
return -1
else:
return 0

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

First thing, remember the importance of the indents. If there is a : (colon), make sure that it follows with an indent.

Second thing, when you are def greater_less_equal(answer), the argument () here is (answer). So when using the if: and elif: statement, it's basically asking "if" the argument (remember that it's answer here) is > 5, then it will return a 1. Otherwise, it will return a -1 or 0, depending on what (answer) is given.

In order to test the solution, the print function already gives you a number to use for the (answer) argument. The numbers they give are: (4), (5), (6). I hope this helps!

#9

Thank you so much!! i got it

#10

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