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



I am lost on what I need to do any help would be wonderful


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



Hi you define a function with a argument answer so you should use it in your if and else if statement


Wait sorry what?
What do you mean by that?


Basically you have already defined your answer variable, so you are doing more than you need to when typing your numbers before the comparators in your function. CC comes up with a number and assigns it to answer for you, so you just need to use that instead of using your own numbers.


You are passing the function a variable (answer) but it is never actually used in your function definition. Just read through your if statements and you will agree that 4 is not greater than 5 so it will never return 1. Similarly 6 is not less than 5. This is why you return all 0's.

You want to pass in the argument into the if statements.

if answer>5 :
return 1
if answer <5 :
return 1


Thank you I will try it now and see what happens.


I do not know what I am doing wrong now rip brains


Like the instruction says..
if statement to check if answer is greater than 5.
Do you see how it should be now?
then it says..
elif so that the function outputs -1 if answer is less than 5.


I am sorry bro still confused really sorry :disappointed:


You still are not passing in a variable (answers) You are hardcoding your if statements.

you have
if 6>5 :

The aim of this exercise is to test if some variable is greater than or less than. The three function calls at the bottom are testing those numbers against the conditions. So by hardcoding statements, your function really doesn't do anything.

This is a screen shot of mine. noting how in my if blocks I am comparing the variable against a value. You have a value vs a value.


ohhhhhhhhhhhhhhhhhh lol. Thank you very much good sir this makes it clear :kissing_heart: no homo


and off topic do they do c and c++ coding on here or can I learn that elsewhere


There are a ton of interactive tutorials for c out there. Just hit the google. http://www.sololearn.com/ has a c++ program


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