empty_dict = {} student = {"name": "Tom", "age": 17, "height": 68}
print(student["age"]) # 17
=
operator:
# adds new key-value pair student["year"] = 11 print(student["year"]) # 11 # updates existing key-value pair student["age"] = 18 print(student["age"]) # 18
in
keyword:
print("name" in student) # True print("grade" in student) # False
del
keyword with the key:
del student["height"] print(student["height"]) # Traceback (most recent call last): # File "main.py", line 3, in <module> # print(student["height"]) # KeyError: 'height'
Your code
Your code
Your code
Your code
Your code
Your code
Your code
Your code
Your code