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
1 Antwort
+ 6
This will convert the result into an integer if it ends with .0:
sum_ = x+y
if sum_%1 == 0:
sum_ = int(sum_)
x = 4.0 y = 4 print(x + y) (output:) 8.0