Plutonic Rainbows

More Functions II

Return the value of one function and use it as an argument of another function.

def add(value_1, value_2):
	return value_1 * value_2
	
def subtract(value_1, value_2):
	return value_1 - value_2
	
def divide(value_1, value_2):
	return value_1 / value_2
	
def multiply(value_1, value_2):
	return value_1 * value_2
	
age = add(6,45)
height = subtract(7,1)
weight = divide(210, 2)
BMI = multiply(105, 6)

print "Age is: %d." % age;print "Height is: %d." % height;print "Weight is: %d." % weight
print "BMI is: %d." % BMI

what = add(age, subtract(height, multiply(weight, divide(BMI, 2))))

print "That becomes: ", what, "Can you do it by hand?"