Answers for "print the second minimum element of an array python"

1

how to find second maximum element of an array python

maximum1 = max(lst) 
maximum2 = max(lst, key = lambda x: min(lst)-1 if (x == maximum1) else x)
Posted by: Guest on October-31-2020
0

get second min no from array in python

import heapq
def second_smallest(numbers):
    return heapq.nsmallest(2, numbers)[-1]

second_smallest([1, 2, 3, 4])
# Output: 2
Posted by: Guest on September-12-2021

Code answers related to "print the second minimum element of an array python"

Python Answers by Framework

Browse Popular Code Answers by Language