Why does %d truncate 1.5 but %s prints the number correctly? : <p>I am taking the Python class at codecademy and I am supposed to print each item in a pair of dictionaries, followed by their prices and amount in stock. Here is the code I wrote:</p>

<hr>

<pre><code>prices = { 
    "banana" : 4,
    "apple"  : 2,
    "orange" : 1.5,
    "pear"   : 3,
}
stock = {
    "banana" : 6,
    "apple"  : 0,
    "orange" : 32,
    "pear"   : 15,
}

for fruit in prices:
    print fruit
    print "price: %d" % prices[fruit]
    print "stock: %d" % stock[fruit]
</code></pre>

<hr>

<p>The output is correct for everything except the price of an orange. Using %d, it prints a value of 1. When I replace %d with %s, the correct value of 1.5 is printed, but I don't understand why %d does not work with decimal values. 1.5 is a number, so shouldn't I be using %d rather than %s in this case?</p>
