From the course: Python Functions for Data Science

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Python min() function

Python min() function - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Python min() function

- When you're working with numerical data in Python, the built-in function Min can be fundamental to your work. The min function takes in either a sequence as input or a series of two or more items as inputs. When given a sequence min returns the smallest item in the sequence. When given a series of two or more items, min returns the smallest item among them. Now I'll be walking through a few examples to illustrate how min works. First, let's say that I have a variable named nums that contains a tuple of integers. To find the smallest item in this tuple. I can call the min function and pass it nums. It would look like this. When I run this cell, I get -2, which is indeed the smallest item in nums. Next, say that I have a variable named listF that contains a list of floating point numbers. To find the smallest item in this list, I can call the min function and pass in list F. It would look like this. When I run the cell,…

Contents