5
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by knan
1

Well a simple fix would be to multiply everything by 10. Ie:

import os
print float(1+1+1-3)/10
os.system("pause")
1

To be at sure side add in beginning of your numeric Python 2 code:

from __future__ import division

This makes 1/4 produce 0.25, not 0 (integer division). For integer division use // operator.

0

Thank you very much everyone... Now i understand the reason behind it... Thank you!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.