Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Data Structures – Dictionaries | Python Fundamentals lesson | BraveProgrammer
  1. Courses
  2. /
  3. Python Fundamentals

Lesson 17 of 55

·Python

Data Structures – Dictionaries

20 minutes

Course progress31%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • Dictionaries store key‑value pairs, accessed via `dict[key]`.
  • Keys must be immutable and hashable.
  • Common methods: `.keys()`, `.values()`, `.items()`, `.get()`, `.pop()`.

Data Structures – Dictionaries

Dictionaries map keys to values. They’re mutable, and as of Python 3.7 they preserve insertion order.

person = {'name': 'Bob', 'age': 25}
person['city'] = 'New York'
print('Name:', person['name'])

# Iterate over items
for key, value in person.items():
    print(key, ':', value)

Keys must be hashable (e.g., strings, numbers, tuples). Values can be any object.

Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Python FundamentalsBrowse activities
Previous lessonData Structures – SetsContinue to lesson 18String ManipulationBack to Python Fundamentals curriculum