Solution: Teach Your Code to Remember Lots of Things!
Explore how to build Python programs that remember information using dictionaries. Understand key-value pairs and practice looping through dictionary items to display stored data clearly and effectively.
We'll cover the following...
We'll cover the following...
This program stores information about you in a dictionary and then prints each piece of information neatly.
The
medictionary holds data in key–value pairs.A key is like a label (e.g.,
"name").A value is the information that label points to (e.g.,
"Your Name").
me.items()returns all key–value pairs from the dictionary.The
forloop goes through each pair one by one, storing them inkeyandvalue.The
print()statement displays them in a readable format.