Using Try...Except...Finally
Mon 10 August 2026
try:
file = open("data.txt", "r")
except FileNotFoundError:
print("File not found")
finally:
print("Cleanup operations executed")
File not found
Cleanup operations executed
Score: 10
Category: chapter6_exception_handling