I am using python 2.7, and the code I have is:
a = 10.5 * 22.34 / 2.0 print \"%.2f\" % a
and the result I expect is 117.29, but it shows 11
Mr. Skeet has the correct answer, below is an example of how to use the decimal module to which he refers:
import decimal a = decimal.Decimal('117.285') rounded = a.quantize(decimal.Decimal('.01'), rounding=decimal.ROUND_HALF_UP) print rounded # 117.29 repr(rounded) # "Decimal('117.29')"