Module 5

Dictionaries

Storing key-value pairs.

Labeled data

A dictionary stores pairs of keys and values. Each key is associated with a value. You look up a value by its key.

Python
sample = {"id": "Tv01", "length": 499, "gc": 54.2}
print(sample["id"])
print(sample["length"])
Tv01 499
Your task

Create a dictionary

  • Create a dict with id and length, print the id.