Max Function
Predict Output Easy
Question
What does this code print?
Code
print(max([3, 7, 2, 9, 1]))
Hint
max returns the largest element.
Explanation
max([3, 7, 2, 9, 1]) returns 9, the largest value. max also works with multiple arguments: max(3, 7, 2). For custom comparison, use key: max(items, key=len).
Related Resources
Related Lessons
- Data Types
Learn Python data types.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.