I Got 99 Problems, But a Switch Ain't One help with negative sign


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

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

I put in the negative sign, but it does not print it.

```python

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

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

<do not remove the three backticks above>

#2

Look here:

Why is answer a string?


#3

uhhh i dont know. Is it supposed to be something else.


#4

We’re trying to compare with our parameter, (which isn’t a string). Python will just recognize "answer" as 1.

When we call our function and insert an argument like this (4 is our argument):

Or function won’t do what we want because it’ll only compare with the string, "answer". We don’t want our parameter to be a string.


#5

Okay i get it thank you.


#6

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