Skip to content
← Python for AI/ML · all 50 levels

Dictionaries

Level 27 of 50 · Data structures

Level 27 of 50

Dictionaries

explained with sabzi prices. Watch the reel, then work through it below: run the code, take the quiz, keep the cheat sheet.

📒 Open the cheat sheet
SanaBhai, onions kitne ke? And potatoes? And tomatoes?
TeacherEvery item has a price! In Python, that's a dictionary!
mandi.py
price = {"aloo": 80,
         "pyaz": 120}
print(price["pyaz"])
TeacherKey, colon, value. Then ask by the key!
SanaWhy a WORD inside the square brackets?
TeacherThat's the key! No counting positions. Just ask by name!
mandi.py
price = {"aloo": 80}
price["tamatar"] = 200
print(price)
TeacherNew key? Just assign it! Tomatoes, added!

⏸ Pause & predict: what prints?

n = {"Ali": 300,
     "Ali": 321}
print(n["Ali"])
Next: Looping dicts →← Sets

Where this leads

Python is step one. Building AI that ships is the rest.

The diploma takes you from zero to deployed computer vision, LLM and agent projects, with engineers who build them for a living. Already code? The bootcamp does it in three months.