Try-Except

Domain: Programming Fundamentals

🎯 Motivation

The mechanism for catching exceptions and handling them gracefully instead of crashing.

📋 Concrete Example

try: file = open('data.txt') except FileNotFoundError: print('File missing!') - catches the error and prints a friendly message.

🔗 Analogy

A safety net under a tightrope walker - if they slip (error), the net (except) catches them instead of letting them fall (crash).