Maximum value storing capacity of int in Python 3
Mostly we will talk about Python 3 rather than Python 2.7
In Python the values are not restricted by the bits and can extend to the limit of their available memory.
x = 10000000000000000000000000000000000000000000 ;
x = x + 2
print (x)
|
Output :
10000000000000000000000000000000000000000002
like in C/C++ and other programming languages we no need of any special arrangement like long int for storing the bigger number, but in Python 2.7 we have used long int but in Python 3 no need of that.
Basically in Python 2.7 two types of int are available i.e int and long int. And in Python 3 only one type i.e int
Lets see this by some piece of code to demonstrate int and long int in Python 2.7 and Python 3.
x = 10
print ( type (x))
x = 10000000000000000000000000000000000000000000
print ( type (x))
|
Output in Python 2.7 :
<type 'int'>
<type 'long'>
Output in Python 3 :
<type 'int'>
<type 'int'>
We may want to try more interesting programs like below :
print
(2
00
*
*2
00
)
and check the output.
In this article i have explained the difference between 'int' in Python 2.7 and Python 3.
#python training #python data analysis #best python tutorial #python classes near me #learn python for beginners #python online training #django course #advanced python course #python course fees #introduction to data science in python #free python tutorial #learn python basics #python study #python and ai #python computer science #learn python step by step #best course to learn python #learn python with projects #python artificial intelligence tutorial
|
#python
#anaconda
#opencv
#matplotlib
#python online
#python programming
0 Comments
If you have any doubt, Please let me know.