



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Today
Reading
Homework
Basics
Topics
Note:
Every key is unique in a dictionary
d = {โaโ: 1, โbโ: 2, โaโ: 3}
d {โaโ: 3, โbโ: 2}
Dictionaries support many of the same operations as lists
d = {โaโ: 1, โbโ: 2, โcโ: 3}
d[โaโ] # subscript 1
d[โdโ] = 1 # add a key-value pair d {โaโ: 1, โbโ: 2, โcโ: 3, โdโ: 1}
d[โaโ] = 2 # set a key value d {โaโ: 2, โbโ: 2, โcโ: 3, โdโ: 1}
d.get(โaโ) 2
d.get(โeโ, 0) # alt value 0
โaโ in d # key in dictionary True
โeโ in d False
โeโ not in d True