Lesson 11
Working with Dictionaries
Store data with keys and values
1Creating Dictionaries✨
💻 code
student = {"name": "Alice", "age": 12, "grade": 7}
scores = {"math": 95, "english": 88, "science": 92}2Accessing Values🎯
- student["name"] # "Alice"
- scores["math"] # 95
3Adding & Modifying💡
💻 code
student["email"] = "[email protected]" # Add
student["age"] = 13 # Update4Checking Keys🚀
💻 code
if "name" in student:
print(student["name"])5Looping Through Dictionaries🔍
💻 code
for key in student:
print(f"{key}: {student[key]}")6Using Dictionaries⭐
💻 code
# Grade calculator
grades = {"math": 95, "english": 88, "science": 92}
average = sum(grades.values()) / len(grades)
print(f"Average: {average}")💻 code
# Phone directory
contacts = {
"Alice": "555-1234",
"Bob": "555-5678"
}🎯 Practice Challenges
Master Working with Dictionaries by completing all 3 difficulty levels
🟢 EASY
Working with Dictionaries - Easy Challenge
Start with the basics. Perfect for beginners!
🟡 MEDIUM
Working with Dictionaries - Medium Challenge
Get more challenging. Build your confidence!
🔴 HARD
Working with Dictionaries - Hard Challenge
Master this concept. Prove your skills!
🏆 Study a lesson for 2+ minutes to earn +10 TalentJR Points a day. Badges, certificates & prizes →
Ready to Master Working with Dictionaries? 🚀
Complete the challenges, take the quiz and keep your learning streak going!
Keep learning
- ← Previous lessonLesson 10: Introduction to ListsStore multiple values in a single variable
- Next lesson →Lesson 12: Data Processing BasicsCollect and process data effectively
- Grade 6 coursePython Control FlowPython coding course for kids.
- Student ToolsFree calculators for studentsPercentage, fraction, ratio and marks calculators with steps.
- CBSEClass 5 CBSE & NCERT study materialMaths, Science and Computer chapters with solutions.
- Future SkillsExplore future skillsAI, robotics and new-age skills explained for students.