def dgree(value): return (value * 9/5) + 32 print(dgree(100)) | Sololearn: Learn to code for FREE!
+ 1

def dgree(value): return (value * 9/5) + 32 print(dgree(100))

How to remove floating point

3rd Sep 2021, 3:24 AM
Sarthak Dandgawhal
Sarthak Dandgawhal - avatar
6 ответов
+ 3
return int(.....)
3rd Sep 2021, 3:39 AM
Igor Kostrikin
Igor Kostrikin - avatar
+ 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()
3rd Sep 2021, 4:10 AM
raynard
raynard - avatar
+ 2
Use int() function
5th Sep 2021, 2:50 AM
Thirunalankumar
Thirunalankumar - avatar
+ 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)
3rd Sep 2021, 5:35 AM
Shadoff
Shadoff - avatar
+ 1
You have to do a cast with int def dgree(value): return (value * 9/5) + 32 print(int(dgree(100)))
4th Sep 2021, 7:47 AM
Gigi
+ 1
Return Math.floor(value*9/5) +32
4th Sep 2021, 4:36 PM
khààlid Mohamud
khààlid Mohamud - avatar