0

does python always have a decimal after a math problem

when I answered a question it had 2 options 6 and 6.0 i answered with 6 but why was 6.0 the right answer

23rd Mar 2019, 2:42 AM
Hacked JJSJSJS
Hacked JJSJSJS - avatar
2 ответов
+ 5
int != float
23rd Mar 2019, 3:54 AM
Flandre Scarlet
Flandre Scarlet - avatar
+ 2
No, it depends on the situation. Decimals tipically appear with divisions (e.g. 5/2 == 2.5) or when other decimals are involved (e.g. 1 + 1.0 == 2.0).
23rd Mar 2019, 3:10 AM
Diego
Diego - avatar