Program Console Vignaankosh.com
Execution Panel
Console is empty.
Delete dictionary using del keyword is an interactive PYTHON dry run visualizer from the Dict programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.
This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.
# Delete entire dictionary using del
my_dict = {"a": 1, "b": 2, "c": 3}
print("Before deletion:", my_dict)
# Delete the entire dictionary
del my_dict
# Trying to access after deletion causes error
try:
print(my_dict)
except NameError as e:
print(f"\nError after deletion: {e}")
# Delete specific key from dictionary
another_dict = {"x": 10, "y": 20, "z": 30}
print(f"\nBefore deleting key: {another_dict}")
del another_dict["y"]
print(f"After deleting key 'y': {another_dict}")
# Delete non-existent key raises KeyError
try:
del another_dict["w"]
except KeyError as e:
print(f"Error: Key {e} not found")