Dictionaries in Python


Explore dictionaries for storing data as key-value pairs, ideal for representing complex information.

Source Code

my_dict = {"name": "Bob", "age": 25}
my_dict["city"] = "New York"  # Adding a key-value pair
print(my_dict["name"])  # Accessing a value
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments