Already Passed
What does the `get()` method in a dictionary do?
A) Deletes a key-value pair
B) Updates the value of a key
✔✔C) Retrieves the value for a specified key
D) Checks if a key exists
What is the output of `len({"a": 1, "b": 2, "c": 3})`?
A) 2
✔✔B) 3
C) 4
D) 1
What is the result of `list({"a": 1, "b": 2, "c": 3})`?
A) `['a', 'b', 'c', 1, 2, 3]`
✔✔B) `['a', 'b', 'c']`
C) `[1, 2, 3]`
1
, D) `[('a', 1), ('b', 2), ('c', 3)]`
What will `dict1 = {"a": 1}; dict1["b"] = 2` result in?
A) `{"a": 1}`
B) `{"b": 2}`
✔✔C) `{"a": 1, "b": 2}`
D) Error
What does `dict1.pop("a")` do if `dict1 = {"a": 1, "b": 2}`?
✔✔A) Removes the key "a" and returns its value
B) Removes the key "b"
C) Returns `None`
D) Deletes the entire dictionary
Which of these methods returns all keys from a dictionary?
A) `values()`
✔✔B) `keys()`
C) `items()`
2