Using Finally Block

Mon 10 August 2026
try:
    file = open("data.txt", "r")
except FileNotFoundError:
    print("File not found")
finally:
    print("Execution completed")
File not found
Execution completed


Score: 10

Category: chapter6_exception_handling