Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introducing Dictionaries!
You have completed Introducing Dictionaries!
Preview
Learn how to write a Python dictionary and recognize and create key:value pairs.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Just like lists are wrapped
in square brackets,
0:00
dictionaries are wrapped in curly braces.
0:00
Each element inside the curly
braces is a key value pair,
0:03
separated from the previous by a comma.
0:06
A key is a label or an identifier for
its associated value.
0:09
For instance, if I'm using a dictionary
to model or store data about myself,
0:13
and one piece of data I want to include
is my name, I create a key-value pair
0:18
where the key is the string name,
and the value is the string Ashley.
0:23
I could also use a key-value
pair to store my profession.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up