The easiest impossible exercise in the world


#1

Cant progress. I dont know what is the elif means. I dont understand the hints. I dont understand the error message. I dont understand anything. I keep trying 6>5 or 2.9 > 5 or 'Answer' = 5 but no. That would be too easy and the hint is soooo ambigous I have absolutely no clue what should I do. I am that lose to breaking computer screen.

https://www.codecademy.com/en/courses/python-beginner-BxUFN/3/4?curriculum_id=4f89dab3d788890003000096#


#2

Please post your code :slight_smile:


#3

We start with most of the code already set up for us. Just a matter of filling in the blanks:

def greater_less_equal_5(answer):
    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)

Here's what we are asked to do...

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.

What is impossible in this? For now, ignore the example (don't try to copy from it). Read the instructions carefully. Replace the blanks with the appropriate expression. Be sure to use the parameter variable.


#4

Guys I have tried many things id doesnt work. There is a reason I am saying it is the easiestimpossible exercise. I have no clue what I should do and why it is not working.


#5

The parameter is answer so use it in the comparisons. How do we check if answer is greater than 5?

if answer > 5:

and less then 5?

if answer < 5:

#6

def greater_less_equal_5(answer):
if 'answer' > 5:
return 1
elif 'answer' < 1:
return -1
else:
return 0

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

I did that and still didn't work. My code is
def greater_less_equal_5(answer):
if answer > 5:
return 1
elif answer < 1:
return -1
else:
return 0

DIdnt work. I tried to put answe as a string still didnt work.
if 6 > 5:
return 1
elif 6 < 5:
return -1
else:
return 0

Still didnt work.
def greater_less_equal_5(answer):
if 4 > 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)¨

still didnt work
THen I always get this stuupid message that I understad squat about what is it trying to say

Oops, try again. It looks like your function output -1 instead of 0 when answer is 5. Make sure you filled in the if and elif statements correctly!


#7

■■■■ it worked.
I did what mtf did and it worked. Unbelievable. Cant believe how something so simple seem like the world most difficult task.


#8

Thanks to everyone for supprt and advice. Time to learn some more.


#9

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