Maximum and Minimum values for ints

Python

I am looking for minimum and maximum values for integers in python. For eg., in Java, we have Integer.MIN_VALUE and Integer.MAX_VALUE. Is there something like this in python?

1
Answers

Replies

In Python 3, an integer is unbounded. It doesn't have a maximum or minimum size. It is only limited by the system’s maximum size. However, you can find the system maximum word size in python 3 by using sys.maxsize. The maximum value representable by an unsigned word is sys.maxsize * 2 + 1.



In Python 2, you can get the maximum limit of an integer with sys.maxint.



sys.maxint


9223372036854775807

 
 

If you want to unleash your potential in this competitive field, please visit the Python course page for more information, where you can find the Python tutorials and Python frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.