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 max() function

Python max() function - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Python max() function

- Another built-in Python function that is fundamental when analyzing numerical data is max. The max function takes in either a sequence as input or series of two or more items as the inputs. When given a sequence, max returns the largest item in the sequence. When given a series of two or more items, max returns the largest item among them. I'll be walking through a few examples to illustrate how Max works. First, lets say that I have a variable named nums that contains a tuple of integers. To find the largest item in this tuple I can call the max function and pass in nums. It would look like this. (keyboard keys clicking) When I run this cell, I get nine, which is indeed the largest item in nums. Next, say that I have a variable named listF that contains a list of floating-point numbers. To find the largest item in this list, I can call the max function and pass in listF. I would look like this. (keyboard keys…

Contents