You should return another bool if a+b
is not 12
def foo(a,b):
if a+b == 12:
return True
else:
return False
answer1 = foo(1,3)
answer2 = foo(7,5)
if answer1:
print "1 + 3 = 12"
if answer2:
print "7 + 5 = 12"
foo()
will return True
if a+b
== 12, if not should return False
2
solved Python Function that returns None [duplicate]