Problem No 3
Implement a function to find the maximum of three
Easy≈ 10 minute session
Lesson guide
What this Python exercise practices
Implement a function to find the maximum of three is a beginner practice lesson that focuses on functions, parameters, return values. It is designed to be solved in about 10 minutes with examples, starter code, and test feedback.
Prerequisites
- Python variables
- Function parameters
- Return values
Difficulty and time
- Level
- Beginner
- Estimated time
- 10 minutes
Practice path
Summary
Return the largest of three values using a function.
Problem statement
Write a function named max_of_three that takes three numeric arguments and returns the maximum of them. The function should handle integers and floats and return the exact value (not a string). Do not print; return the result.
Task
Create max_of_three(a, b, c) that returns the largest of the three inputs.
Examples
Find max of three
Input
max_of_three(1, 5, 3)
Output
5
Explanation
The largest of 1, 5, and 3 is 5.
Input format
Call max_of_three(a, b, c) with three numbers.
Output format
Return the maximum numeric value among the three arguments.
Constraints
Do not use prints. The function should return a single numeric value.
Samples
Sample input 0
max_of_three(10, 7, 9)
Sample output 0
10
Explanation 0
10 is the largest of the three.
AI assistant
Ask me anything!
Need help? I can explain the core idea behind this problem, review your current code, and give targeted hints. Use “Teach Theory” for the concept, “Get AI hint” for a quick scaffold nudge, or ask a specific question below.
Chat history is temporary and will not be saved.
Free preview includes 1 Teach Theory response and 1 AI hint per unlocked preview lesson.