What is a dictionary in Python?
A collection of key-value pairs.
What is a list in Python?
A list is an ordered collection of items that can be changed (mutable).
A collection that is ordered and can change
List
How do you access a value in a dictionary?
Use its key, like dictionary[key].
How do you create a list with three numbers: 1, 2, and 3?
my_list = [1, 2, 3]
A collection that is ordered but cannot change?
Tuple
What is the result of this code?
12
What method do you use to add an item to the end of a list?
append()
A collection where each item has a unique key?
Dictionary
How do you add a new key-value pair to a dictionary?
dictionary[new_key] = value.
How can you remove an item from a list by its value
remove()
What method would you use to add an item to a list at a specific index?
insert()
Can a dictionary have duplicate keys?
No, keys in a dictionary must be unique
What does the following code print:
[20, 30]
How do you create a copy of a list?
list.copy() or list[:]