You need to specify that at least one of the inputs to the division is a floating point number by adding an explicit decimal point.
a = 1500. / 1589
print round(a, 2)
# 0.94
If you do not do this, both 1500
and 1589
are treated as integers and the result of 1500/1589
is required to be an integer (0
) as well
1500 / 1589
# 0
print round(1500 / 1589, 2)
# 0.0
As a side note, if you want to print a number with two decimal places, a far easier method is to create a formatted string:
print '%0.2f' % (1500. / 1589)
# 0.94
print '{:.2}'.format(1500. / 1589)
# 0.94