Python for Biologists
Lectures
Labs
Resources
Assessment
Schedule
About
GitHub →
← Lab 2
Dictionaries —
lookup tables
Look it up
▸
Key → value pairs: codon_table = {"ATG": "Met", …}
▸
Look up by key: codon_table["ATG"] → "Met"
▸
Missing key → KeyError; use .get(codon, "?") to stay safe
Build & check
▸
Add or update: codon_table["TGG"] = "Trp"
▸
Search a key: "ATG" in codon_table → True / False
▸
Values can be numbers, lists, even other dicts
📓 Dictionaries — practice notebook →
← Previous
←
Next →
→