0
Why is 10 / 2 5.0 not 5?
Why is 10 / 2 5.0 not 5 if it has the meaning of divisor? (phyton)
2 Respostas
+ 3
ints and floats are different data types.
When you divide something, Python automatically makes the result a float - because it might have decimals, right?
If you don't want that, you can use // instead.
But if you then divide let's say 11 by 2, the result will be 5.
+ 2
Like HonFu said
Python use float variables
If you want 5 you can do:
print(int(10/2))