Python

Python Menu

Python

Python max() Function - Definition, Syntax, Parameters, Examples

Definition

The max() function returns the item with the highest value, or the item with the highest value in an iterable. If the values are strings, an alphabetical comparison is done.

Syntax

max(iterable)

Parameters

Parameter Description
iterable An iterable, with one or more items to compare

Examples

myMax = max(1, 2, 3, 4, 5) print(myMax) maxString = max("apple", "banana", "cherry") print(maxString)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods