0
Why output print ((4+8)/2) becomes 6.0????? It should be 6,not6.0
6 Réponses
+ 4
The result of division is float by default in python.
+ 4
If you want to print the result as int change the type.
print(int((4+8)/2))
Happy coding!
0
When you use a division sign it turns the number you are dividing by into a float, or a number with a decimal place. The float does not have to have a number after the decimal, it can just be a 0.
0
asma zadeh
to get 6 use floor division //
(4+8) // 2 = 6
0
Thank you all🙂💕
- 1
print((4 + 8) / 2)
6.0