what am I doing wrong here?
Well in your if and elif statements, you can't just compare nothing > 5. You need to decide what should you compare to get the appropiate answer you want! Ultimately, you are trying to compare each answer that is imputed into the print statements below. Those are 4, 5, and 6. How, in this function, do we go about achieving this?
That is a good try. However, its not looking for a numerical answer but a parameter answer. Because, you are printing the function with a number in its parameter at the bottom correct? So it would make sense then, if you are replacing your parameter answer with a number to test the if and else statement, what should you use when comparing instead of numbers in your if and elif statement?
Try putting in a variable like x where you have greater than and equal to symbols. Your 1st code threw an error because you had this:
> 5 and < 5
Python code doesn't like that.
Try something like this:
def function(answer): for x in answer: if x > 5:
And so on.
remind me again, what is a parameter answer?
def greater_less_equal_5(answer): is your function. Your parameter for this function is answer as it is inside your ():.
so how should i fill this in, I just dont understand it?
im in the same boat, ive flown through the rest of the course but i am completely lost here
I just tried everything i learned so far and the hint doesn't really help all that much
Have you thought about using your parameter (answer) in your function comparison statements? If answer > 5 for example would plug back in whatever number you assign for your parameter in your print statements at the bottom.
For further example for both you and @boardwhiz77040
if answer > 5:
The code above is an example of using your parameter to reach your goal. See because now, if you run the print statement print greater_less_equal_5(6) your code will return the 6 through the parameter answer as you are saying the parameter answer = 6. therefore, your code will run if 6 > 5 return 1 so it will return 1 on the screen because it passes that criteria.
that was a lot simpler that is what it made it seemed. I think I over complicated it in my head
Well I am sorry if my explanation was over complicated. I was trying my best to explain what you were supposed to code without giving it away immediately but since I saw confusion was reigning I figured spilling the beans and explaining it would work just as well glad it worked out and I hope the rest of your python journey is not nearly as confusing haha
Thank you. I was over complicating it
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.