Skip to main content

Practice · 2 of 2

Success Path in else

CHALLENGE
Difficulty: beginner+25 XP

Refactor: keep the try block containing ONLY the risky conversion, move the success print into else, and keep the error print in except. Output must stay identical for both a valid and an invalid value.

Back to lesson: Practice: else/finally & Fail-Fast Drills