+ 3

floats

In this following example, why would it output "5.0" and not "5"? >>> 10 / 2 5.0

30th Nov 2018, 10:44 PM
Kelly Wu
1 Antwort
+ 4
Because in Python 3 it always returns a float. If you want an integer use 10//2 or int(10/5)
30th Nov 2018, 11:02 PM
Matthias
Matthias - avatar