Why dictionaries are used
๐ Scenario: Imagine you run a small library. You want to keep track of books and their authors quickly. You need a way to find the author of any book easily.
๐ฏ Goal: You will create a dictionary to store book titles and their authors. Then, you will look up authors by book titles to see why dictionaries are useful.
๐ What You'll Learn
Create a dictionary called
library with exact book-author pairsCreate a variable called
book_to_find with a specific book titleUse dictionary access to get the author of
book_to_findPrint the author name
๐ก Why This Matters
๐ Real World
Libraries, stores, and many apps use dictionaries to quickly find information by a unique key like a book title or product code.
๐ผ Career
Knowing how to use dictionaries helps you work with data efficiently, a key skill in programming jobs like web development, data analysis, and software engineering.
Progress0 / 4 steps