Learn Python Dictionaries - get(), items(), pop(), Comprehensions (Tutorial #10)
6views
009:26
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Learn Python dictionaries in this beginner-friendly tutorial! 📖
In this lesson, you will learn:
✅ Creating dictionaries with curly braces
✅ Accessing values with brackets and get()
✅ Modifying: update, add, delete with del
✅ Dictionary methods: keys(), values(), items()
✅ update(), pop(), setdefault()
✅ Iterating over dictionaries
✅ Dictionary comprehensions
✅ Mini Project: Contact Book with nested dictionaries
🕐 Timestamps:
0:00 - Introduction
0:22 - Dictionary Basics Explained
0:46 - Dictionary Basics Demo
2:48 - Dictionary Methods Explained
3:12 - Dictionary Methods Demo
5:04 - Mini Project Explained
5:28 - Contact Book Demo
8:23 - Recap
8:58 - End
💻 Source Code: https://github.com/GoCelesteAI/python_dictionaries
📚 Code from this lesson:
# Dictionary Basics
person = {"name": "Alice", "age": 25}
print(person["name"])
print(person.get("email", "N/A"))
del person["city"]
# Dictionary Methods
for k, v in scores.items():
print(f"{k} scored {v}")
scores.update(new_scores)
removed = scores.pop("Charlie", 0)
squares = {x: x ** 2 for x in range(6)}
# Contact Book (nested dicts)
contacts[name] = {"phone": phone, "email": email}
for name, info in contacts.items():
print(f"{name}: {info['phone']}")
🔗 Previous: Lesson 9 - Tuples & Sets
🔗 Next: Lesson 11 - Functions
#Python #PythonTutorial #LearnPython #Programming #Dictionaries #PythonDict
Tags
Python, Python tutorial, Python for beginners, learn Python, Python dictionaries, dict, key-value pairs, get method, items method,
dictionary comprehension, nested dictionaries, contact book, CelesteAI