I'm trying to figure out what's going on, and am really stuck:
def add(a,b):
print "ADDING %d + %d" % (a,b)
return a+b
def subtract(a,b):
print "SUBTRACTING %d - %d" %(a,b)
return a-b
def multiply (a,b):
print "MULTIPLYING %d * %d" %(a,b)
return a*b
def divide (a,b):
print "DIVIDING %d / %d" % (a,b)
return a/b
print "Let's do some math with just functions!"
age = add(30,5) # state A
height = subtract (78,4) # state A
weight = multiply (90, 2) # state A
iq = divide (100, 2) # state A
print "Age: %d, Height: %d, Weight: %d, IQ: %d" % (age, height, weight, iq) # state B
I can't understand why in state A the outcome is the second line of the functions, where there's print, while in state B the outcome is the true output of the function, which I think is accomplished by return.
Apologize if the terminology is not very accurate.
Thanks