Hi there, I am getting this error File “python”, line 12
elif (a > 21):
^
IndentationError: unindent does not match any outer indentation level while executing following code, can someone guide me?
Make sure that the_flying_circus() returns True
def the_flying_circus():
a = raw.input("enter your age ")
if (a >= 18 and a <= 21): # Start coding here!
print "young, but not allowed to marry"
return True
# Don't forget to indent
# the code inside this block!
elif (a >= 21):
print "Yeah, you can marry"
return True
elif(a < 18):
print "age is too low"
return True
else:
print "somehing you entered which is not age"
return True
# Keep going here.
# You'll want to add the else statement, too!
def the_flying_circus():
#indent 4 spaces
a = raw.input("enter your age ")
if (a >= 18 and a <= 21): # Start coding here!
#indent 4 spaces, to indicate the IF code-block
print "young, but not allowed to marry"
return True
# Don't forget to indent
# the code inside this block!
elif (a >= 21):
#indent 4 spaces, to indicate the ELIF code-block
print "Yeah, you can marry"
return True
elif(a < 18):
#indent 4 spaces, to indicate the ELIF code-block
print "age is too low"
return True
# Keep going here.
# You'll want to add the else statement, too!
else:
#indent 4 spaces, to indicate the ELSE code-block
print "somehing you entered which is not age"
return True
leonhard_wettengmx_n
This is what I have so far: # Make sure that the_flying_circus() returns True
def the_flying_circus():
a = input(“Please Enter Your Age!”)
if (a >=18 and a <=21): # Start coding here!
print “Young, You Are Not Allowed To Marry!”
return True
# the code inside this block!
elif (a >=21):
print “You Are Allowed To Be Married!”
return True
# You’ll want to add the else statement, too!
elif (a < 18):
print “You Are Too Young To Be Married!”
return True
It doesn’t seem to be working. It comes up saying The following exception was raised when calling the_flying_circus(): SyntaxError: unexpected EOF while parsing (, line 0)
I’m Quite New To This So I Don’t Remember A lot! If You Could Help That Would Be Very Handy! Thanks, TeraNinja
instead of raw.input, it should be raw_input, then the code will work on the console.
like this def the_flying_circus(): #indent 4 spaces a = raw_input("enter your age ") if (a >= 18 and a <= 21): # Start coding here! #indent 4 spaces, to indicate the IF code-block print "young, but not allowed to marry" return True # Don't forget to indent # the code inside this block! elif (a >= 21): #indent 4 spaces, to indicate the ELIF code-block print "Yeah, you can marry" return True elif(a < 18): #indent 4 spaces, to indicate the ELIF code-block print "age is too low" return True # Keep going here. # You'll want to add the else statement, too! else: #indent 4 spaces, to indicate the ELSE code-block print "somehing you entered which is not age" return True
and leonhard’s code have helped me a lot, thank for that
def the_flying_circus():
x = raw_input(“enter a number!”)
if ( x <= 10 ):
print ("Wow you must be 10 or less!")
return True
elif ( x > 10 and x <= 20 ):
print "Wow you must be between 10 and 20!"
return True
elif ( x > 20 and x <= 30 ):
print "Wow you must be between 20 and 30!"
return True
else:
print "You must be really old, you are older than 30"
return True
def the_flying_circus():
x = raw_input("enter a number!")
if ( x <= 10 ):
print ("Wow you must be 10 or less!")
return True
elif ( x > 10 and x <= 20 ):
print "Wow you must be between 10 and 20!"
return True
elif ( x > 20 and x <= 30 ):
print "Wow you must be between 20 and 30!"
return True
else:
print "You must be really old, you are older than 30"
return True
I’m incredibly confused. I’ve tried rewriting and copying/pasting your code here, as well as experimenting with my own and while I can pass the course, I can’t get anything to print to the console. Does anyone know why that might be?
Call the function to execute it in the console: the_flying_circus()
The raw_input appears to be considering the input as a string rather than an integer so no matter what number is inputted, it prints the else message. Wrap it with int()
x = int(raw_input("enter a number!"))
def the_flying_circus():
if ( x <= 10 ):
print ("Wow you must be 10 or less!")
return True
elif ( x > 10 and x <= 20 ):
print "Wow you must be between 10 and 20!"
return True
elif ( x > 20 and x <= 30 ):
print "Wow you must be between 20 and 30!"
return True
else:
print "You must be really old, you are older than 30"
return True
the_flying_circus()
Please Help… The program is passing me, but nothing coming in console where I Can Input my age
def the_flying_circus():
result = raw_input("Enter Your Age!")
if (result > 1 and result < 18):
print "you are not allowed in the show"
return True
elif (result >= 19):
print "Yes!! You are allowed to enter"
return True
else:
print "Please enter your age properly"
return True
def the_flying_circus():
a = raw_input(“whats your age”)
if (a >= 18 and a <= 21) :
print “young, you are not allowed to marry”
return True #Dont forget to indent
# the code inside this block!
elif (a >= 21):
print " you are allowed to marry"
return True
# You’ll want to add the else statement, too!
elif (a < 18):
print " you are too young to be married"
return True
else:
print"something you entered is not related to age"
return True
This is my code but it shows an error as the following
File “python”, line 13
elif (a < 18):
^
SyntaxError: invalid syntax