floats | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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 Respuesta
+ 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