Copyright © tutorialspoint.com
This function returns x rounded to n digits from the decimal point.
round( x [, n] ) |
Here is the detail of parameters:
x: This is a numeric expression.
n: This is also a numeric expression.
The x rounded to n digits from the decimal point.
#!/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 |
Copyright © tutorialspoint.com