---
title: "How do you find the maximum and minimum values in a list in Python?"  
description: "How do you find the maximum and minimum values in a list in Python?"  
author: "Utpal Vishwas"  
published: 2023-06-26  
updated: 2023-06-27  
canonical: https://www.mindstick.com/forum/158868/how-do-you-find-the-maximum-and-minimum-values-in-a-list-in-python  
category: "python"  
tags: ["python", "list"]  
reading_time: 2 minutes  

---

# How do you find the maximum and minimum values in a list in Python?

How do you find the [maximum and minimum values](https://www.mindstick.com/forum/158958/how-to-find-the-maximum-and-minimum-values-in-a-list-using-python) in a list in [Python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?

## Replies

### Reply by Aryan Kumar

There are two built-in functions in Python that you can use to find the maximum and minimum [values](https://www.mindstick.com/forum/327/sum-textbox-values) in a list:

- `max()`: Returns the largest value in a list.
- `min()`: Returns the smallest value in a list.

For example, the following code finds the maximum and minimum values in the list `list1`:

Python

```plaintext
list1 = [1, 2, 3, 4, 5]
max_value = max(list1)
min_value = min(list1)
print(max_value, min_value)
```

This will print the following output:

Code snippet

```plaintext
5 1
```

The `max()` and `min()` functions can also be used to find the maximum and minimum values in a list of strings. For example, the following code finds the maximum and minimum values in the list `list2`:

Python

```plaintext
list2 = ["apple", "banana", "cherry", "orange", "kiwi"]
max_value = max(list2)
min_value = min(list2)
print(max_value, min_value)
```

This will print the following output:

Code snippet

```plaintext
orange kiwi
```

In this case, the `max()` function compares the ASCII values of the strings in the list. The ASCII value of `orange` is 79, which is the highest in the list. The ASCII value of `kiwi` is 75, which is the lowest in the list.


---

Original Source: https://www.mindstick.com/forum/158868/how-do-you-find-the-maximum-and-minimum-values-in-a-list-in-python

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
