Problem with "Flying Circus" exercice


#1


Problm with "Flying Circus" exercice


Error message is:

File "python", line 5
elif True or False:
^
SyntaxError: invalid syntax

That I miss >, <=,>= , etc but not that I have invalid syntax in Line 5.

def le_cirque_volant():
    # Commencez à coder ici !
    if (3**2) and (4 % 9) != (7/8) or False :
        print "Raté"
        elif  True or False:
            print "Gagné"
        else:
            print "NA";

#2

Indent your code as same level as if statement.
also delete semicolon after else statement's body!

else:
            print "NA";

In Python if/elif/else syntax..

if condition1:
    #your code
elif condition2:
    #your code
else: 
    #yourcode

#3

OPk. Now I get this error message:

Traceback (most recent call last):
File "python/cli_runner.py", line 152, in

NOTE/ I restarted Mozilla Firefox to make sure no bugs...

MY CODE:

def le_cirque_volant():
# Commencez à coder ici !
if (3**2) and (4 % 9) != (7/8) or False :
print "Raté"
elif True or False:
print "Gagné"
else:
print "NA"


#4

File "python/cli_runner.py", line 152, in

152?Are you solving it on idle or CC?

I think you haven't indented your code inside your function,if not? then take a look at this syntax--

def anyfunction():
    if condition1:
        #your code
    elif condition2:
        #your code
    else: 
        #yourcode

#5

What does "idle" and "CC" mean? I don't understand..I use WIndows 7 on a standard PC . Mozilla Firefox latest version.


#6

greentreeme:

you told me earlier to do like this:

elif True or False:
print "Gagné"
else:
print "NA";

Then to indent..I don't understand...


#7

Ok ot works now with your indentation. Thanks anyway..


#8

Python uses Indentation to structure code and separate code blocks.
If you don't indent it properly,You will get error!
Thats what happened!
cheers!


#9

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