1/16
These flashcards cover key operations and functions related to dictionaries and sets in Python programming.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
in operator
Used to determine whether a key exists in a dictionary.
del statement
Used to delete an element from a dictionary.
len() function
Returns the number of elements in a dictionary.
empty dictionary
Created using {}.
popitem() method
Returns a randomly selected key-value pair from a dictionary.
pop() method
Returns the value associated with a specified key and removes that key-value pair from the dictionary.
get() method
Returns the value associated with a specified key or a default value if the key is not found.
items() method
Returns all of a dictionary’s keys and their associated values as a sequence of tuples.
len() function
Also returns the number of elements in a set.
add method
Adds one element to a set.
update method
Adds a group of elements to a set.
discard method
Removes an element from a set but does not raise an exception if the element is not found.
remove method
Removes an element from a set and raises an exception if the element is not found.
| operator
Used to find the union of two sets.
− operator
Used to find the difference of two sets.
& operator
Used to find the intersection of two sets.
ˆ operator
Used to find the symmetric difference of two sets.