How to do Conditionals and Control Flow?


def greater_less_equal_5(answer):
if ________:
return 1
elif ________:
return -1
return 0

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

this is the code manually in the python. I’ve looked, but It hasn’t worked. These are the questions:

  1. On line 2, fill in the if statement to check if answer is greater than 5.
  2. On line 4, fill in the elif so that the function outputs -1 if answer is less than 5.

How do you do it? please explain with solution.


You need to replace the _______ parts.

If you wanted to do something only if answer is bigger than 5 you would do it like this:

if answer > 5:
    # do something here