← back to unit
Easy
# sorting easy
Sort Three Potions With Ifs
Only three potions, and the wizard forbids loops today — sort them with pure if-logic! 🧪
You get three numbers a, b, c on separate lines. Print them smallest to largest, separated by spaces.
Example:
Input: a = 9, b = 2, c = 5
Output: 2 5 9
Compare a and b: 9 > 2, so swap → 2, 9, 5. Compare b and c: 9 > 5, so swap → 2, 5, 9. Compare a and b once more: 2 < 5, already fine. Final order: 2 5 9.
💡 need a hint?
sort-three-potions.py🔒 given lines are locked — write your code in between
loading...