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 Tutorial
From the course: Python Functions for Data Science
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,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Python print() function2m 30s
-
(Locked)
Python input() function2m 1s
-
(Locked)
Python abs() function1m 57s
-
(Locked)
Python round() function2m 10s
-
(Locked)
Python min() function1m 42s
-
(Locked)
Python max() function1m 41s
-
(Locked)
Python sorted() function3m 39s
-
(Locked)
Python sum() function1m 1s
-
(Locked)
Python len() function2m 28s
-
(Locked)
Python type() function2m 22s
-
-
-
-
-
-
-
-