Weird the Big If thing


#1

So I'm stuck on the Big If. I think a lot of people are. My problem is: I type in this code:

def the_flying_circus():
    if the_answer = yeah:    
        print "the flying circus will return!"
       # put your code in this block
    elif the_answer = nah or no:
        print "the flying circus will not return"
    else 
        print "the flying circus may return".

and I recieve this error message:
File "python", line 3
if the_answer = yeah:
^
SyntaxError: invalid syntax

What should I do?


#2

if the_answer = yeah:

we use = for assignment
for cheking two values use == or ===

same for the rest

and missed a : after else

and remove the . at the end(maybe typo)

and now what is yeah and nah or no ?


#3

Hi rcodman,
I am stuck as well with the same problem, could you please advise. Here is my trial and the outcome. Thank you very much in advance.

Make sure that the_flying_circus() returns True

def the_flying_circus():
if the_flying_circus(): == True
print: "Correct" # Start coding here!
# Don't forget to indent
# the code inside this block!
elif the_flying_circus(): == False and not True
print: "Error"
# Keep going here.
# You'll want to add the else statement, too!
else:
print: "Try Again"
Hint:
Oops, try again. An exception was raised while running your code, see the console window for the error message.

Console Window

File "python", line 4
if the_flying_circus(): == True
^
SyntaxError: invalid syntax


#4

At first i should tell you always create a new post.don't post on other's topic.there are many people here who helps :slight_smile:

now what i see you have many more mistake in your code

first of all syntax

if expression: 
    statement(s)  # need 4 spaces
else:
    statement(s)  #need 4 spaces

after complete your expression add :(dont forget it)
same for else if or else
next line take 4 spaces then start your code.To indicate a block of code in Python, you must indent each line of the block by the same amount.you can see two blocks of code in our example if-statement are both indented four spaces.

and dont need a : after print what you did

print: //wrong

now what are you trying to do by following line?

if the_flying_circus(): == True

what is the_flying_circus() ??? do you know this?

its the function.right?so you are trying to check the function is true or not within the same function?is it right?

i dont know what instruction said just see that do the following there may be a example look at that.


#5

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