Write a function to find out the second maximum number in the given list
Topic: Write a function to find out the second maximum number in the given list
Solution
def find_second_maximum(lst): max = float('-inf') sec_max = float('-inf') for elem in list: if elem > max: sec_max = max max = elem elif elem > sec_max: sec_max = elem return sec_max
List all Python Programs