>>> print 6/2
You should see this:
>>> print 6/2
3
now if you type 3/2 it will show:
>>> print 3/2
1
Everyone knows three divided by two is one remainder one! Why is python doing this? Well it's actually trying to be smart.
To fix this type:
>>> 3.0/2
It should look now like this:
>>>3.0/2
1.5
You can also do (12 + 2)*1
2 + 7 * 4
(This will give you 30 because of the python language which does 7 * 4 + 2)
No comments:
Post a Comment