'I need to find the second maximum from the list and tried to find this by using diff method, but this method is not working, but its correct

4th method

def submax(list2): sub = [x for x in list2 if x<max(list2)] return max(sub) if name == 'main': list2 = [70, 11, 20, 4, 100] print(submax(list2))



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source