Python readings – Integer

Python readings – Integer deals with handling numbers in python strictly integers.

import sys

print("Python Integer")
print sys.maxsize

print type(sys.maxsize )
print type(sys.maxsize +1 )
Python Integer
2147483647
<type 'int'>
<type 'long'>
a = 10
b = 20
c = -10

print type(a)
print isinstance(a, bool)
print max(a,b)
print max(a,c)
print cmp(a,b)
print abs(a)
print abs(c)

<type 'int'>
False
20
10
-1
10
10
For builtin function in python refer here 2.0 and 3.3.

Leave a Reply

Your email address will not be published. Required fields are marked *