Set Flashcards

1
Q

What is a set?

A

an unordered collection of unique objects

{1, 2, 3, 4, 5}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Set methods

A

.difference: creates a set containing the difference from the primary set and the set passed in as an argument

.discard: takes in a value as an argument and modifies the set by removing the value from the set

.difference_update: modifies the set by removing the values that the original set has that the argument set does not have

.intersection: returns a set of the values that are the same across both sets

.isdisjoint: returns a boolean, True or False, in response to the question ‘does these two sets have overlapping elements?’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly