Home » Python min() function with Examples

Python min() function with Examples

by Online Tutorials Library

Python min() Function

Python min() function is used to get the smallest element from the collection. This function takes two arguments, first is a collection of elements and second is key and returns the smallest element from the collection.

Signature

Parameters

collection: It is a comma-separated list of elements.

key: Specifies a one-argument ordering function.

Return

It returns the smallest element from the collection.

Let’s see some examples of min() function to understand it’s functionality.

Python min() Function Example 1

A simple example to get the smallest element from the collection. See the below example.

Output:

325  1000.25  

Python min() Function Example 2

Output:

A  [10, 12]  

Python min() Function Example 3

Output:

Java  [13, 15]  

Next TopicPython Functions

You may also like