python round off

Solutions on MaxInterview for python round off by the best coders in the world

showing results for - "python round off"
Simon
16 Jun 2017
1int x = 6.3456824221
2
3#round(number_to_roundoff, round_off_till)
4#round_off_till is optional
5
6print(round(x))    		#output: 6
7print(round(x, 3)) 		#output: 6.346
8print(round(x, 1)  		#output: 6.3
Matteo
21 Oct 2019
1# round(number, decimals=0)
2
3n = 10.84859734
4
5round(n)     # 11
6round(n, 1)  # 10.8
7round(n, 2)  # 10.85