import sys
t1 = sys.maxint
t2 = sys.maxint+1 #Automatically transforms to long if it exceeds the int range
print(t1)
print(t2)
print(type(t1))
print(type(t2))
Output:
9223372036854775807
9223372036854775808
<type 'int'>
<type 'long'>
Formally, -sys.maxint-1
is the way to obtain the minimum value. link
import sys
t1 = sys.maxsize
t2 = sys.maxsize+1 #This is also type int
print(t1)
print(t2)
print(type(t1))
print(type(t2))
Output:
9223372036854775807
9223372036854775808
<class 'int'>
<class 'int'>
Python 3 treats integers beyond the int range as type int.
© 2024 OneMinuteCode. All rights reserved.