Python 3

In Python 3, this question doesn't apply. The plain int type is unbounded.

However, you might actually be looking for information about the current interpreter's word size, which will be the same as the machine's word size in most cases. That information is still available in Python 3 as sys.maxsize, which is the maximum value representable by a signed word. Equivalently, it's the size of the largest possible list or in-memory sequence.

Generally, the maximum value representable by an unsigned word will be sys.maxsize * 2 + 1, and the number of bits in a word will be math.log2(sys.maxsize * 2 + 2). See this answer for more information.

Python 2

In Python 2, the maximum value for plain int values is available as sys.maxint:

>>> sys.maxint  # on my system, 2**63-1
9223372036854775807

You can calculate the minimum value with -sys.maxint - 1 as shown in the docs.

Python seamlessly switches from plain to long integers once you exceed this value. So most of the time, you won't need to know it.

Answer from senderle on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_func_max.asp
Python max() Function
Remove List Duplicates Reverse ... Interview Q&A Python Training ... The max() function returns the item with the highest value, or the item with the highest value in an iterable....
People also ask

What is the use of the max() and min() functions in Python?
We use Python's max() and min() functions to get the maximum or minimum object out of a set of objects or max/min object out of objects in a given iterable.
🌐
interviewkickstart.com
interviewkickstart.com › home › blogs › learn › max() function in python: syntax, parameters, and examples
max() Function in Python: Syntax, Parameters & Examples
What is the difference between the Python max() and min() functions?
Both compare items or items within an iterable on some basis and return a value. But the max() function in Python returns the max value after those comparisons, and the min() function returns the minimum value.
🌐
interviewkickstart.com
interviewkickstart.com › home › blogs › learn › max() function in python: syntax, parameters, and examples
max() Function in Python: Syntax, Parameters & Examples
🌐
Programiz
programiz.com › python-programming › methods › built-in › max
Python max()
# find max among the arguments result = max(4, -5, 23, 5) print("The maximum number is:", result) ... If you need to find the smallest item, you can use the Python min() function.
🌐
GeeksforGeeks
geeksforgeeks.org › python › maximum-of-two-numbers-in-python
Find the Maximum of two numbers in Python - GeeksforGeeks
For example: Input: a = 10, b = 8 Output: 10 · Let's explore different ways to find the larger of two numbers. max() function compares two or more values and returns the largest one.
Published: May 18, 2026
🌐
freeCodeCamp
freecodecamp.org › news › maximum-integer-size-in-python
Int Max in Python – Maximum Integer Size
April 3, 2023 - In Python 2, you can check the max integer size using the sys module's maxint property.
🌐
Analytics Vidhya
analyticsvidhya.com › home › mastering python’s maximum integer value
Mastering Python's Maximum Integer Value
July 5, 2024 - # Example of modular arithmetic large_number = 10**100 modulus = 10**10 result = large_number % modulus print(result) # Keeps the number within a manageable range · Let us now explore some practical examples to work with python maximum integer value.
Find elsewhere
🌐
Vultr Docs
docs.vultr.com › python › built-in › max()
Python max() - Find Maximum Value
September 27, 2024 - Use the max() function to determine the highest number.
🌐
Tutorialspoint
tutorialspoint.com › python › number_max.htm
Python max() Function
# Creating a list List = [74,587,24,92,4,2,7,46] res = max(List) print("The largest number in the list is: ", res)
🌐
DataCamp
datacamp.com › tutorial › everything-you-need-to-know-about-pythons-maximum-integer-value
What You Need to Know About Python's Maximum Integer Value | DataCamp
May 6, 2024 - In a 32-bit system, the maximum integer value was (231 - 1), which was equal to 2,147,483,647. In a 64-bit system, the maximum integer value was (263 - 1), which was equal to 9,223,372,036,854,775,807.
🌐
Interview Kickstart
interviewkickstart.com › home › blogs › learn › max() function in python: syntax, parameters, and examples
max() Function in Python: Syntax, Parameters & Examples
April 1, 2026 - This is the most direct use of max() in Python. You can pass a list of integers, and it will return the largest number.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-program-to-find-largest-number-in-a-list
Python Program to Find Largest Number in a List - GeeksforGeeks
Explanation: reduce(lambda x, y: x if x > y else y, a) compares each pair of elements in the list a and keeps the larger one, cumulatively returning the maximum value. A native approach that iterates through the list and updates a variable if a larger number is found. Python ·
Published: November 11, 2025
🌐
Reddit
reddit.com › r/learnprogramming › how do i represent integer.max_value (java) in python?
r/learnprogramming on Reddit: How do I represent Integer.MAX_VALUE (Java) in Python?
August 3, 2020 -

It seems there is no equivalent of Integer.MAX_VALUE in Python, since the integer type is unbounded. The reason I'm looking at a way to represent it is because I found Java code that I want to translate and run in Python. Both programs are attempted solutions to this stock trading problem.

Java code (Line 3):

public class Solution {
    public int maxProfit(int prices[]) {
        int minprice = Integer.MAX_VALUE;
        int maxprofit = 0;
        for (int i = 0; i < prices.length; i++) {
            if (prices[i] < minprice)
                minprice = prices[i];
            else if (prices[i] - minprice > maxprofit)
                maxprofit = prices[i] - minprice;
        }
        return maxprofit;
    }
}

I was able to come up with the code below, which runs but outputs the wrong result. I'm looking for a way to assign the right value to minprice which would lead to the desired output - I put 0 but it's just a filler.

Python code (Line 3):

class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        minprice=0
        maxprofit=0
        l=len(prices)
        for i in range(l):
            if prices[i]<minprice:
                minprice=prices[i]
            elif prices[i]-minprice>maxprofit:
                maxprofit=prices[i]-minprice
        return maxprofit 

My question is:

  • In the original Java program, how does the Integer.MAX_VALUE work? How does it help with the use of minprice later?

  • How can I replace it sensibly in the Python program?

🌐
Hyperskill
hyperskill.org › university › python › max-in-python
Python max() Function — Syntax, key Parameter & Examples
August 10, 2026 - Complementary functions help define ... elements in a sorted sequence. When searching for a number, within a series of numbers you can make use of the max() function....
🌐
Note.nkmk.me
note.nkmk.me › home › python
Integer (int) Has No Max Limit in Python 3 | note.nkmk.me
January 27, 2024 - The long type has no max or min limit. The int type in Python 3, equivalent to the long type in Python 2, has no max or min limit.
🌐
CodeGym
codegym.cc › java blog › learning python › int max or sys.maxint in python
Int Max or sys.maxint in Python
July 29, 2024 - Max Number: sys.maxsize gives the largest practical integer value. Number1: Assigning a value one less than sys.maxsize. Comparison: Checking if number1 is less than max_number. Understanding and using sys.maxsize in Python is useful for various ...
🌐
GeeksforGeeks
geeksforgeeks.org › sys-maxint-in-python
sys.maxint in Python - GeeksforGeeks
May 9, 2025 - In Python 2, sys.maxint refers to the maximum value an integer can hold on a given platform. This value is: ... sys.maxint was typically used as a very large number in algorithms requiring an upper bound, like finding minimum values in a list.
🌐
Pierian Training
pieriantraining.com › home › using the max function in python
Using the Max Function in Python - Pierian Training
April 28, 2023 - The max() function in Python is a built-in function that returns the largest item in an iterable or the largest of two or more arguments. The max() function can be used with lists and tuples to find the largest element.
🌐
GeeksforGeeks
geeksforgeeks.org › maximum-of-two-numbers-in-python
Find Maximum of two numbers in Python - GeeksforGeeks
For example, given two numbers a = 7 and b = 3, you may want to extract the larger number, which in this case is 7. Let's explore different ways to do this efficiently.Using max()max() function is the most opt ...
Published: May 9, 2025
🌐
Real Python
realpython.com › python-min-and-max
Python's min() and max(): Find Smallest and Largest Values – Real Python
October 22, 2025 - Python’s built-in functions max() and min() allow you to find the largest and smallest values in a dataset. You can use them with iterables, such as lists or tuples, or a series of regular arguments. They can handle numbers, strings, and even dictionaries.