Python Basics
Python Advanced
Python Useful References
Python Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Python Number round() Function
Description:
This function returns x rounded to n digits from the decimal point.
Syntax:
Parameters:
Here is the detail of parameters:
Return Value:
The x rounded to n digits from the decimal point.
Example:
#!/usr/bin/python
print "round(80.23456, 2) : ", round(80.23456, 2)
print "round(100.000056, 3) : ", round(100.000056, 3)
print "round(-100.000056, 3) : ", round(-100.000056, 3)
|
This will produce following result:
round(80.23456, 2) : 80.23
round(100.000056, 3) : 100.0
round(-100.000056, 3) : -100.0
|
|
|
|