The Big If


I got stuck at The Big If.. The below code works, but i still haven't the faintest idea why the "return True" is needed. do all the ifs and elifs need to be returned as True?

def the_flying_circus():
a = raw_input ("How old are you?")
if a > 25: # Start coding here!
return True
print "You're older than me!"
elif a < 25:
return True
print "You're younger than me!"
print "You and I were born in the same year!"
return True

Replace this line with your code.


you only need one return True, just make sure that you then enter a number which will make it reach the return True

but a big problem is here:

a = raw_input ("How old are you?")

raw_input stores as string, and comparing strings and integers is a bad idea. use int() to make a an integer


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