Python

Creating Dictionaries

Dictionaries

Dictionaries store key-value pairs.

person = {
    "name": "Alice",
    "age": 25,
    "city": "Paris"
}

print(person["name"]) # Alice print(person["age"]) # 25

Your Task

Create a dictionary student with keys "name" (value: "Alex") and "grade" (value: 85). Print the name.

script.py
Loading PYTHON engine...
Downloading Python… (one-time, ~10 MB)

Downloading Python… (one-time, ~10 MB)

This runs entirely in your browser and is cached for next time.