Answers for "get second min no from array in python"

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

Python Answers by Framework

Browse Popular Code Answers by Language