round(flt,ndig=0) rounds a floating point number to the nearest integral number : Round : Buildin Function PYTHON TUTORIALS


PYTHON TUTORIALS » Buildin Function » Round »

 

round(flt,ndig=0) rounds a floating point number to the nearest integral number


# When the optional ndig option is given, round() will round the argument to the specific number of decimal places.

print round(3)
print round(3.45)
print round(3.4999999)
print round(3.49999991)

import math

for eachNum in range(10):
     print round(math.pi, eachNum)

print round(-3.5)
print round(-3.4)
print round(-3.49)
print round(-3.491)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Buildin Function
» Round