How to find the maximum value in a list using Python?

To find the maximum value in a list, you can use the built-in max() function in Python. Simply pass the list you want to find the maximum value of as a parameter. Here is an example code:

my_list = [3, 7, 1, 9, 4]
max_value = max(my_list)
print(max_value)

You can copy and paste the code above into the Python interpreter to find the maximum value in the list [3, 7, 1, 9, 4].

广告
Closing in 10 seconds
bannerAds