Given three values a, b, and c, the biggest is the one that is greater than or equal to both of the others.
Remember
Example: a = 14, b = 7, c = 22
22 >= 14 and 22 >= 7 → biggest is 22
Ties: a = 10, b = 10, c = 3
either 10 is a valid maximum
a
b
c
Biggest
14
7
22
22
10
10
3
10
-5
-2
-9
-2
5
5
5
5
Approach
How to Find the Biggest of Three Numbers in Python
Compare pairwise (or call max) and prefer >= so ties stay correct.
If a >= b and a >= c, return a.
Else if b >= a and b >= c, return b.
Otherwise return c.
Shortcut: max(a, b, c).
Method
Idea
Time
Best for
If-elif ladder
Explicit >= checks
O(1)
Interviews, default
max
max(a, b, c)
O(1)
Short production code
Nested max
max(a, max(b, c))
O(1)
Teaching pairwise max
Pseudocode
Pseudocode
function Biggest(a, b, c):
if a >= b and a >= c:
return a
if b >= a and b >= c:
return b
return c
Reference
Cheat Sheet
Keep these patterns handy while coding.
Topic
Detail
a wins
a >= b and a >= c
b wins
b >= a and b >= c
else
return c
One-liner
max(a, b, c)
Many values
Use a running-max loop (see Maximum of Array)
Try it
Live Preview
Enter three numbers to see which is biggest.
Integers and decimals both work. Tap a chip or type your own values.
Result
a = 14, b = 7, c = 22
biggest = 22
Trace
Worked Walkthrough — 14, 7, 22
Apply the if-elif ladder step by step.
Calculation
a = 14, b = 7, c = 22
Is a >= b and a >= c?
14 >= 7 → true
14 >= 22 → false
→ a is not the biggest
Is b >= a and b >= c?
7 >= 14 → false
→ b is not the biggest
Otherwise return c
biggest = 22
Code
Python Programs
Start with an if-elif ladder, then use built-in max, and finish with nested pairwise max.
Example 1 — If-Elif Ladder
Explicit comparisons with >= — the interview default.
Python
def find_biggest(num1, num2, num3):
if num1 >= num2 and num1 >= num3:
return num1
elif num2 >= num1 and num2 >= num3:
return num2
return num3
number1 = 14
number2 = 7
number3 = 22
result = find_biggest(number1, number2, number3)
print(f"The biggest number is: {result}")
Output
The biggest number is: 22
How It Works
If num1 is at least as large as the other two, return it.
Else if num2 wins both comparisons, return num2.
Otherwise num3 must be the maximum.
>= keeps ties correct (equal largest values still return a valid max).
Sample 14, 7, 22 prints 22.
Example 2 — Built-in max
Short and idiomatic — Python max accepts any number of arguments.
Python
def find_biggest_with_max(a, b, c):
return max(a, b, c)
a = 14
b = 7
c = 22
print(f"The biggest number is: {find_biggest_with_max(a, b, c)}")
Output
The biggest number is: 22
How It Works
max returns the largest of its arguments.
Pass all three values in one call: max(a, b, c).
Same answer as the if-elif ladder — fewer lines.
Still explain the ladder in interviews before relying on the built-in.
14, 7, 22 → 22.
Example 3 — Nested max
Pairwise nesting — useful when teaching two-argument max.