Create a dictionary and display elements Dry Run in PYTHON

Create a dictionary and display elements 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.

Create a dictionary and display elements Program Code

# Create a dictionary using curly braces
student = {
    "name": "John Doe",
    "age": 20,
    "course": "Computer Science",
    "grade": "A"
}
print("Dictionary:", student)
print("Type:", type(student))

# Create using dict() constructor
employee = dict(name="Alice", position="Manager", salary=50000)
print("\nUsing dict():", employee)

# Display elements individually
print("\nStudent Details:")
print(f"Name: {student['name']}")
print(f"Age: {student['age']}")
print(f"Course: {student['course']}")

View the complete Dict programs page.

Program Console Create a dictionary and display elements Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.