YouTip LogoYouTip

Python Max List Element

# Python3.x Python Find Maximum Element in List [![Image 3: Document Object Reference](#) Python3 Examples](#) Define a list of numbers and find the maximum element in the list. For example: Input: list1 = [10, 20, 4] Output: 20 ## Example 1 ```python list1 = [10, 20, 4, 45, 99] list1.sort() print("Maximum element is:", list1) The output of the above example is: Maximum element is: 99 ## Example 2: Using the max() method ```python list1 = [10, 20, 1, 45, 99] print("Maximum element is:", max(list1)) The output of the above example is: Maximum element is: 99 [![Image 4: Document Object Reference](#) Python3 Examples](#)
← Pyhton Remove Ith Character FrEnv Run β†’