Reputation: 2733
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print(111111111111111111/10)
1.1111111111111112e+16
>>> print(int(111111111111111111/10))
11111111111111112
>>>
Refering to the above snippet, Can someone please help me understand why 111111111111111111/10
returns 11111111111111112
instead of 11111111111111111
?
Upvotes: 0
Views: 68
Reputation: 71580
Use floor division:
>>> 111111111111111111//10
11111111111111111
>>>
Upvotes: 3