Menu

Sign in to track your progress and unlock all features.

Theme style

Log in
01. Define a function that adds two numbersE02. Write a function that returns a greetingE03. Implement a function to find the maximum of threeE

Problem No 3

Implement a function to find the maximum of three

Easy

10 minute session

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.

Code editor
Loading editor…

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.

12:44 PM

Free preview includes 1 Teach Theory response and 1 AI hint on each of the first 3 lessons in this module.