The big if


#1

Hi guys, im not very sure what's wrong with my code. It just says there should not be any arguments .. :frowning:

Make sure that the_flying_circus() returns True

def the_flying_circus(answer):
if (answer >5) and (answer <10):
return 1
elif answer <5:
return -1
else:
return 0

print the_flying_circus(4)
print the_flying_circus(6)
print the_flying_circus(11)

pls pls pls help

OH and whats the difference between string and non string? :frowning:


The Big If
#2

The function shouldn't have any parameter.
So instead of def theflying_circus(answer):_ you should write def the_flying_circus(): and remove all answer in your Code. It should also return True instead of 1, i"m not really sure but i think Python doesn't recognize 1 and 0 as True and False.

String is a sequence of character. For example

x = 42 --> x is not a string
x = "42" --> x is a string


#3

May we please have a link to the exercise in question so we can further examine and test your code? Thank you.

While it won't convert a 1 to True or a 0 to False in a normal statement, Python does have the ability to convert truth values in a conditional expression.
https://docs.python.org/2.4/lib/truth.html