The Big IF ,I don't understand the error


#1



# Make sure that the_flying_circus() returns True
def the_flying_circus():
    a = raw_input ("Howmuch i(s 5**3)= ):    # Start coding here!
    if (a < 125 and a != 125):
print "This is incorect, value too low! Try again "  # Don't forget to indent
    return True    # the code inside this block!
     the_flying_circus ()
     
    elif (a > 125 and != 125):
print "This is insorrect, value too high! Try again"# Keep going here!
    return True
     the_flying_circus ()    

    elif (a == 125):# You'll want to add the else statement, too!
print "Correct! You still know some mathematic!"
    return False
    
    else (a not >= 125 or not <= 125):
print "You didn't input valid decimals! Try again!"
    return True
    the_flying_circus ()

File "python", line 3
a = raw_input ("Howmuch i(s 5**3)= ): # Start coding here!
^

SyntaxError: EOL while scanning string literal


That it would work !


`python


#2

The 3rd line has been fixed in this way:
a = raw_input ("Howmuch is (5**3)= ): # Start coding here!


#3

Hi you should indent all your print statement

#this is wrong
def example(name):
   if name == "gred":
print "Heloo"

#this is right
def example(name):
   if name == "gred":
      print "Heloo"

#4

hello experts... please help me... what's wrong here? def the_flying_circus():
a = 10
if (a % 2 == 0 and a % 5 == 0):
print "if works"
elif (a != 5 or a % 23 == 9 ):
print "elif works"
else:
print "nothing"
the_flying_circus()


#5

HI instead of print statement you should use the return statement and also you shound't print strings but return True or return False in your if, else if and else statement


#6

Thanks a lot... i have just used the return statement and it works... :slight_smile:


#7

Even with this my program doesn't work...can you help me? I would be gratefull!


#8

Hi can you post your code?


#9

Make sure that the_flying_circus() returns True

def the_flying_circus():
a = raw_input ("Howmuch is (5**3)= ) # Start coding here!
if (a < 125 and a != 125):
print "This is incorect, value too low! Try again " # Don't forget to indent
return True # the code inside this block!
the_flying_circus ()

elif (a > 125 and != 125):
    print "This is incorrect, value too high! Try again"# Keep going here!
return True
 the_flying_circus ()    

elif (a == 125):# You'll want to add the else statement, too!
    print "Correct! You still know some mathematics!"
return False

else (a not >= 125 or not <= 125):
    print "You didn't input valid decimals! Try again!"
return True
the_flying_circus ()

#10

This is the code I waned to express, but It has many defaults I guess.
Could you show me all the mistakes I've wrote and so also show/write
a clean version of my program? I thank you verry much!


#11

Hi.. this line

a = raw_input ("Howmuch is (5**3)= )

you should close the " then in this line it's missing the a

elif (a > 125 and != 125)

just after the != and the else statement doesn't take any condition

else (a not >= 125 or not <= 125):

if condition:
   #do something
elif condition:
   #do something
else:
   #do something

#12

I tried this as I am trying to understand, because It is difficult to understand all in English I guess:

Make sure that the_flying_circus() returns True

def the_flying_circus():
a = raw_input ("Howmuch is (5**3)=" )
a == 125# Start coding here!
if (a < 125):
print "This is incorect, value too low! Try again " # Don't forget to indent
return True # the code inside this block!
the_flying_circus ()

elif (a > 125):
    print "This is incorrect, value too high! Try again"# Keep going here!
    return True
    the_flying_circus ()    

elif (a == 125):# You'll want to add the else statement, too!
    print "Correct! You still know some mathematics!"
    return False

else (a != 125):
    print "You didn't input valid decimals! Try again!"
    return True
    the_flying_circus ()

I received a warning with this content:

File "python", line 19
else (a != 125):
^
SyntaxError: invalid syntax


Could you also tell me what is wrong here?


#13

the else statement doesn't take any condition

else (a != 125):
    print "You didn't input valid decimals! Try again!"
    return True
    the_flying_circus ()

just remove the (a != 125)


#14

Eventhrough it doesn't run my program to make me answert, the course said I pased!
Thank you verry much wizmarco!


#15

if you wan it toinput the number you should call the function like that

def the_flying_circus():
    a = raw_input ("Howmuch is (5**3)=" )
    a == 125# Start coding here!
    if (a < 125):
        print "This is incorect, value too low! Try again " # Don't forget to indent
        return True # the code inside this block!
        the_flying_circus ()

    elif (a > 125):
        print "This is incorrect, value too high! Try again"# Keep going here!
        return True
        the_flying_circus ()    

    elif (a == 125):# You'll want to add the else statement, too!
        print "Correct! You still know some mathematics!"
        return False

    else:
        print "You didn't input valid decimals! Try again!"
        return True
        the_flying_circus ()
#here call the function without indent
the_flying_circus ()