Learn Python The Hard Way, Ex21, EC3
<p><strong>Ex21, Extra Credit 3:</strong> Once you have the formula worked out for the puzzle, get in there and see what happens when you modify the parts of the functions. Try to change it on purpose to make another value.</p>

<p><strong>My code:</strong></p>

<pre><code>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)
height = subtract(78, 4)
weight = multiply(90, 2)
iq = divide(100, 2)

print "Age: %d, Height: %d, Weight: %d, IQ: %d" % (age, height, weight, iq)



print "Here is a puzzle."


# new formula
what = add(height, subtract(weight, multiply(iq, divide(age, 2))))

# original formula
# what = add(age, subtract(height, multiply(weight, divide(iq, 2))))



print "That becomes: ", what, "Can you do it by hand?"
</code></pre>

<p>The new formula that I wrote for this exercise is under the comment # new formula. After writing it and running it I noticed that something odd is happening: the floating point in the division age / 2 is ignored. </p>

<p><strong>Question:</strong> Why does Python ignore the floating point in age/2 (also further operations) and how can I make it to not ignore it?</p>
