The big if, the flying circus


#1

hi all,

can u please find my problem here?

input = raw_input("Pick a number:")
print the_flying_circus(input)

def the_flying_circus(input):
	if (input > 6) and (input != 7):
		return "True"
	elif input == 7:
		return	"not 7"
	else:
		return "try again"
		
		print the_flying_circus(input)
		print the_flying_circus(input)
		print the_flying_circus(input)

the output i get:
Pick a number: 7
True
None

the error:
Oops, try again. the_flying_circus should not take any arguments.

thank you!!!


#2

This is not a problem any of us wish to solve under the present duress.


#3

im sorry, not got you,
under what?


#4

Hi Tom,

Your code's indentation isn't currently showing up, which makes it so we can't run the code to find the problem in it. Please read:

then edit your post and format your code so it shows up properly, and leave a reply so we'll get a notification.


#5

ahh ok
its done.

you can see now?


#6

Hello, @tom_vaknin!
The last lesson of the fifth section, Conditionals & Control Flow, is to simply create a program with the function given that follows the rules stated there:

1. if, elif, and else statements;
2. At least one of and, or, or not;
3. A comparator (==, !=, <, <=, >, or >=);
4. Finally, the_flying_circus() must return True when evaluated.

Like the error is telling you, there should be no argument for the function the_flying_circus() and you're doing the opposite.
There's no need to ask for input from the user, simply write the function and call it.

Quote me if there's anything else I can help you with!

Best regards,
g4be


#7

First of all, delete those two out of there. You cant call "the_flying_circus", if you haven't even defined it... :confused:
As for the input, you should be able to input every time, you call the function, so it's not good as where it is right now :slightly_smiling:

The error tells you, that the function shouldn't take any arguments, so delete the "input" from there. :frowning:

About the number input I talked about before, should be placed around here:

def the_flying_circus():
    input = raw_input("Pick a number:")

As for the variable, you shouldn't use input, because there is a built-in function called input(). Better use another name, so you don't mix things up. Because you want a number (an integer), you should turn the input in an integer too, like int(raw_input("Pick a number: ") or input("Pick a number: "), both work fine. :smiley:

If you used raw_input() and call the function, you type 3 for example, the "3" will be a string, so it will never be True if you ask 3 == "3". :sweat:


#8

well,
now im trying to do:

def the_flying_circus(answer):
    if answer > 6:
        return "True"
    elif (answer < 8) and (answer != 8):
        return "False"
    else :
        return "try again"
        
        print the_flying_circus(7)

not work again..
im little bit lost the way here..


#9

@tom_vaknin: Your function the_flying_circus() should not have a parameter.
Parameter that "thing" between the parentheses in your function.

In that exercise you're not supposed to have a parameter in that function so instead of:

def the_flying_circus(answer):


it should be

def the_flying_circus():

Quote me if there's anything else I can help you with!

Best regards,
g4be


#10

great! it works!!!

thank you very much


#11

No problem, Tom! Glad to help.


#13