0

I need some help

So i have recently started trying to learn python over java as java has started to confuse me and ive heard good things about python so i try it and its so much easier however i got confused on ((4+8)/2) because i know that comes out as 6 normally but its 6.0, have i missed something or miscalculated it either way i need some help understanding it

27th Aug 2021, 8:49 PM
Owen Tipney
Owen Tipney - avatar
2 Respuestas
+ 4
the / operator returns a float, however you can use // operator to get an integer; Eg. ((4+8)/2) = 6.0 ((4+8)//2) = 6
27th Aug 2021, 9:30 PM
Sousou
Sousou - avatar
+ 2
When you divide using the / operator, it returns a float type, which is a decimal.
27th Aug 2021, 9:11 PM
Chloe
Chloe - avatar