+ 1
If python automatically swaps an integer to a float why does the .0 matter in 5.0 ?
e.g: 5.0 + 6 = 11.0 where .0 from 11.0 has no use or even needed and .0 doesn't give any valuable format too
1 Odpowiedź
+ 5
It's because the result of any mathematical operation that involves at least one float is always a float. It's easier to remember this rule than having to determine that a/b results in an int if a=10 and b=2, but in a float if b=3 etc.