More Functions II
August 09, 2020
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?"
Recent Entries
- Real-world Physics February 01, 2025
- ChatGPT o3-mini January 31, 2025
- Bois Talisman January 30, 2025