November 2018
— No problrm
Can somebody help me with rounding off a floating number. Like I want to round off 0.7 to 01.5 to 11.9 to 1which function should I use?
— X= 0.6y= int(x)
— Round()
— Type casting will just truncate the value after decimal
— Not needed if he's just truncating the value after decimal
— Language:
py3
from math import floornum = 1.5floored = floor(num)print(floored)
1
Message permanent page
— Use math.floor
math.floor
— Its python devs telegram chanell of kazakhstan
— Try n = int(4.5)
— !otherlanguages