Whenever in the python console 3/4 is typed and executed, the output is 0 instead of 0.75. Why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whenever in the python console 3/4 is typed and executed, the output is 0 instead of 0.75. Why?

2nd Sep 2016, 7:42 AM
Aniket Gajjar
Aniket Gajjar - avatar
1 Answer
+ 1
because it's type is int so int(3/4) = 0 if you want 0.75 , you can try float(3/4)
2nd Sep 2016, 7:54 AM
beauty1234