+ 1
def dgree(value): return (value * 9/5) + 32 print(dgree(100))
How to remove floating point
7 Answers
+ 3
return int(.....)
+ 2
Sarthak Dandgawhal
// use floor division for 9//5, if the input is always integer,because it wont matter,the calculation will not return a decimal point that is not 0. If its not then do a round it to the lowest point using int() or math.floor()
+ 2
Use int() function
+ 1
better not to remove floating point. Because convertion from F to C or back gives some NOT whole number.
Instead, you can just round up the result to two digits after point:
res = round(res, 2)
+ 1
You have to do a cast with int
def dgree(value):
return (value * 9/5) + 32
print(int(dgree(100)))
+ 1
Return Math.floor(value*9/5) +32