Python BasicsEasy

Greatest of the Three numbers

Detailed guide and Python implementation for the 'Greatest of the Three numbers' problem.

Problem Statement

Easy

Write a function greatest_of_three(a, b, c) that takes three integers a, b, and c and returns the greatest among them.

Constraints
  • -10^9 <= a, b, c <= 10^9

Examples

Example 1
Input
a = 10, b = 20, c = 15
Output
20
Explanation

20 is the largest among 10, 20, and 15.

Example 2
Input
a = 5, b = 5, c = 5
Output
5
Explanation

All three are equal, so return 5.

Example 3
Input
a = -1, b = -2, c = -3
Output
-1
Explanation

-1 is the greatest among -1, -2, and -3.

Need a Hint?
Consider using Basics-specific data structures like sets or heaps.
Edge Cases to Watch
  • Empty input structures
  • Single element inputs
  • Large numerical bounds

Ready to Solve?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Open in Editor

Recommended Python Resources

Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.