What is the maximum possible value of an integer in Python?

Python Methods and Functions

# Python program to demonstrate what we can store
# big numbers in Python


x = 10000000000000000000000000000000000000000000

x = x + 1

print (x)



In Python, the integer value is not limited by the number of bits and can expand to the limit of available memory (Sources: this and this ) . Thus, we never need any special device to store large numbers (imagine the arithmetic above in C / C++).

As a side note, there is only one type "int" in Python 3 for all types of integers. In Python 2.7. There are two separate types "int" (32-bit) and "long int", which are the same as "int" in Python 3.x, that is, they can store arbitrarily large numbers.

# Python program to show that there are two types in
# Python 2.7: int and long int
# And in Python 3 there is only one type: int


x = 10

print ( type (x))


x = 10000000000000000000000000000000000000000000

print ( type (x))

Output in Python 2.7:

 & lt; type 'int' & gt; & lt; type 'long' & gt; 

Output in Python 3:

 & lt; type' int' & gt; & lt; type 'int' & gt; 

We can try more interesting programs like below:

# Print 100 to raise to power 100

print ( 100 * * 100 )

This article courtesy of Abhay Rati . Please post comments if you find something wrong or if you would like to share more information on the topic under discussion