1.Conditionals & Control Flow
def using_control_once():
if True:
return \”Success #1\”
def using_control_again():
if True:
return \”Success #2\”
print using_control_once()
print using_control_again()
def black_knight():
if answer == \”\’Tis but a scratch!\”:
return True
else:
return False # Make sure this returns False
def french_soldier():
if answer == \”Go away, or I shall taunt you a second time!\”:
return True
else:
return False # Make sure this returns False
def greater_less_equal_5(answer):
if answer > 5:
return 1
elif answer < 5:
return -1
else:
return 0
print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)
def the_flying_circus():
if 2 < 3: # Start coding here!
# Don\'t forget to indent
return True
# the code inside this block!
elif 2 ==3:
# Keep going here.
return False
# You\'ll want to add the else statement, too!
else :
return \'Unbelievable\'