0

Why is this 5.0 Finished instead of 5 Finished if both variables are integers instead of float?

26th Sep 2016, 6:35 PM
Josh Murphy
Josh Murphy - avatar
3 Réponses
+ 2
This is explained in the first lessons : dividing 2 integers gives a float, even if the result can be represented as an integer. This is different that C but you can still perform euclidian division using // instead of /.
28th Sep 2016, 5:51 AM
Frederic Ringeval
Frederic Ringeval - avatar
+ 1
the division operator / converts the integers automatically into floats.
26th Sep 2016, 9:20 PM
Amarie
0
i found this helpful
15th Jan 2017, 10:42 AM
john joshua
john joshua - avatar