Code 2: Find the Second Maximum Element in List in Python | 365 Days of Code

Опубликовано: 28 Сентябрь 2024
на канале: Code House
311
2

Python program to find the second Maximum Element in a list in Python.
Code -
Find Second Maximum Element
data = [34,90,20,48,23,90,23] # Sol is 48
new_set = set(data) # To remove the repeated element
new_list = list(new_set) # Converting set to list
new_list.sort() # Sort the List
print(new_list[-2]) # Print the second last element

#365_Days_Of_Code