Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

PREVIOUS NEXT
Code Example
Python :: how to find out the max and min date on the basis of property id in pandas 
Python :: mean bias error 
Python :: access cmd with python 
Python :: python get output 
Python :: get coordinates of an image from a pdf python 
Python :: pass integer by reference in Python 
Python :: how to print tables using python 
Python :: check if variable is defined in python 
Python :: how to set environment variable in pycharm 
Python :: how to import files from desktop to python 
Python :: how to print values without space in python 
Python :: what is ord function on python 
Python :: how to take an input in python 
Python :: how to use return python 
Python :: sum range 
Python :: python sounddevice stop recording 
Python :: python divide and round away operator 
Python :: df iloc 
Python :: make virtual environment python 
Python :: How to retrieve previous messages with discord.py 
Python :: how to get last dimension of an array python 
Python :: circle python programe 
Python :: string in python 
Python :: string format method python 
Python :: how to find a specific word in a list python 
Python :: pyspark drop 
Python :: python latest version 64 bit 
Python :: how to find duplicates in csv file using python 
Python :: normalizer in sklearn 
Python :: python list function 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =