Maximum storing capacity of int in Python

Maximum storing capacity of int in Python

Maximum value storing capacity of int in Python 3

string indices must be integers, string to int python, int to string python, convert string to int python


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.

# A Python program to demonstrate that we can store
# large numbers in Python
  
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.

# A 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 :

<type 'int'>
<type 'long'>

Output in Python 3 :

<type 'int'>
<type 'int'>

We may want to try more interesting programs like below :


# Printing 200 raise to power 200
print(200**200)


and check the output.


In this article i have explained the difference between 'int' in Python 2.7 and Python 3. 









Recommended Post : Typecasting


                   Statement, Indentation and Comment in Python











 #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









Post a Comment

0 Comments