No. 15: The Big If


#1

#Can someone please help me. This code makes perfect sense to me. Although I keep getting a syntax error message. Can you please tell me what I'm doing wrong? Thank you in advance for any comments/suggestions.**

Here is the code:

# Make sure that the_flying_circus() returns True

def the_flying_circus():
if 5 > 4 and 10 <= 10:
    print ('True')

elif 5 < 4 and 10 <= 10
    print ('False')
    
else:
    print ('True again')

#2

" 04. Finally, the_flying_circus() must return True when evaluated." This gives a hint I believe to what the example in this lesson misleds you on. Instead of print try return for all your print statements. I believe that should fix your problem!


#3

Ahh........Got it!

It indeed was my problem. Thank you very much.


#4

No problem! Happy coding! Your done with Conditionals & Control Flow so now on to my favorite Python lesson PygLatin! Enjoy! :smiley:


#5

Try with this too:

Make sure that the_flying_circus() returns True

def the_flying_circus():
if 0 > 7 and 5**2 < 3: return False # Start coding here!

elif 7 >= 0 or 5**2 > 3: return True 

else: return True

#6

Try this.

Make sure that the_flying_circus() returns True

def the_flying_circus():
if 5 > 4 and 10 <= 10:
return True
elif 5 < 4 and 10 >= 10:
return "False"
else:
return "True again"


#7

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