
If you come from a programming background of Java or C#, you would have known that there is a limit to the max and the min size of an integer datatype based on the underlying system architecture (which is -231 to -231-1 for 64 bit Operating Systems)
But, do you know that the int data type is an arbitrary precision integer, which means that it can represent integers of any size without overflow.
Reference:https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex
"An integer giving the maximum value a variable of type Py_ssize_t can take. It’s usually 2**31 - 1 on a 32-bit platform and 2**63 - 1 on a 64-bit platform."
Reference:https://docs.python.org/3/library/sys.html#sys.maxsize
Example:
import sys
print(f"Max Int: {sys.maxsize}")
print(f"Min Int: {-sys.maxsize - 1}")
Output:
Max Int: 9223372036854775807
Min Int: -9223372036854775808
Have Questions? Post them here!
- tkinter - Hello World! Program
- How to install Python Specific version (3.8, 3.9 or 3.10) using Brew
- How to install SpaCy (NLP Library) on Mac
- Python matplotlib segmentation fault: 11 macOS Big Sur
- How to uninstall pip Python packages
- 3 Ways to find if element is present in a List in Python
- How to Convert Python String to DateTime Object
- Python f-strings Formatted String Literals Syntax and Examples
- Where does brew install python in macOS
- Take input argument from command line in Python Programming
- Advanced print() Function Tutorial and Techniques for Python Developers
- How to add borders to tkinter label text
- Whats new in Python 3.10 Pre-release
- Float built-in function in Python
- List of All 35 Reserved Keywords in Python Programming Language 3.11
- How to check if Key Exists in Python Dictionary?
- Read a file line by line in Python Program
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- What is the Max and Minimum Value of int type in Python?
- What is Terminal Velocity and its Formula? How to calculate it programmatically?
- Fix: TypeError: can only concatenate str (not int) to str in Python
- How to take user input from the console in a Python program
- [Fix] TypeError: str object is not callable in Python
- 3 Python program to add two numbers
- How to delete a file using Python code example
- Mac - Steam Needs to Be Online to Update. Please confirm your network connection and try again error - News
- Notepad++ is about to exit prompt message - NotepadPlusPlus
- How to create a circular Image using pure CSS Code - CSS
- Remove all stopped containers in Docker using prune command - Docker
- How to change default macOS Terminal Window size - MacOS
- JSON Text to JavaScript Object using eval() Example: JSON Tutorial - Json-Tutorial
- Change the default Line Encoding Notepad++ (CR LF) - NotepadPlusPlus
- [Fix] Access Denied - GoDaddy Website Firewall - IP Blocked - HowTos