Google News
logo
Python Program to Find the lowest and highest value in an iterable
You can use the built-in `min()` and `max()` functions in Python to find the lowest and highest value in an iterable. Here's an example program :
Program :
my_list = [2, 3, 5, 1, 4]

lowest = min(my_list)
highest = max(my_list)

print("Lowest value:", lowest)
print("Highest value:", highest)
Output :
Lowest value: 1
Highest value: 5
In the above example, we have a list of integers `my_list`. We use the `min()` function to find the lowest value in the list and assign it to the variable `lowest`.

We use the `max()` function to find the highest value in the list and assign it to the variable `highest`. Finally, we print out the results.