Consider below Python program.
In Python, value of an integer is not restricted by the number of bits and can expand to the limit of the available memory (Sources : this and this). Thus we never need any special arrangement for storing large numbers (Imagine doing above arithmetic in C/C++).
As a side note, in Python 3, there is only one type “int” for all type of integers. In Python 2.7. there are two separate types “int” (which is 32 bit) and “long int” that is same as “int” of Python 3.x, i.e., can store arbitrarily large numbers.
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 :
This article is contributed by Abhay Rathi. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Python - Maximum of Sting Integer list
- Python - Maximum of Consecutive Pair in integer list
- Python - String Integer Product
- Python | sympy.Integer() method
- Python | Binary list to integer
- Convert integer to string in Python
- Python | Convert Tuple to integer
- How to convert string to integer in Python?
- Convert string to integer in Python
- Python program to concatenate two Integer values into one
- Python | Split a list having single integer
- Python | Integer count in Mixed List
- Python - Interconvert Tuple to Byte Integer
- Python - Convert Alternate String Character to Integer
- Python - Smallest integer possible from combination of list elements
- Reverse bits of a positive integer number in Python
- Python - Sort String by Custom Integer Substrings
- Python | Ways to convert Boolean values to integer
- Python Map | Length of the Longest Consecutive 1's in Binary Representation of a given integer
- Python | Multiply Integer in Mixed List of string and numbers