Program Console Vignaankosh.com
Execution Panel
Console is empty.
Traverse dictionary using loop 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.
# Different ways to traverse a dictionary
person = {"name": "Bob", "age": 30, "city": "Chicago", "job": "Developer"}
print("Dictionary:", person)
print("\n1. Iterating over keys:")
for key in person:
print(f" {key}: {person[key]}")
print("\n2. Using keys() method:")
for key in person.keys():
print(f" {key}")
print("\n3. Using values() method:")
for value in person.values():
print(f" {value}")
print("\n4. Using items() method (key-value pairs):")
for key, value in person.items():
print(f" {key} → {value}")
print("\n5. Using enumerate() with items():")
for index, (key, value) in enumerate(person.items()):
print(f" {index}: {key} = {value}")