0

Is there a way to make (ex. x = 4.0, y = 4, print(x + y)) not a float?

x = 4.0 y = 4 print(x + y) (output:) 8.0

27th Apr 2019, 2:01 PM
Tristan Misja
1 Respuesta
+ 6
This will convert the result into an integer if it ends with .0: sum_ = x+y if sum_%1 == 0: sum_ = int(sum_)
27th Apr 2019, 3:00 PM
Anna
Anna - avatar