Else Problems, I Feel Bad for You, Son


#1

answer = "'Tis but a scratch!"

def black_knight():
if answer == "'Tis but a scratch!":
return True
else: print "I don't printed!"
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: "I get printed!"
return False # Make sure this returns False


#2

Please advise by telling me if my code syntax is correct.


#3

Here is my revised syntax.:

answer = "'Tis but a scratch!"

def black_knight():
if answer == "'Tis but a scratch!":
return True
else: print "I don't printed!"
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: print "I don't printed!"
return False # Make sure this returns False


#4

when you put else: it should simply be else: followed by the return on the next line. in both cases where you used else, you need to remove what you are printing.