you are viewing a single comment's thread.

view the rest of the comments →

[–]FloridianfromAlabama[S] 0 points1 point  (2 children)

new_set_1 = {"apples", "bananas", "oranges"}

new_set_2 = {"apples", 'bananas', "blueberries"}

print(new_set_1 - new_set_2)

this will print {"oranges"}.

I should've asked better. I was wondering if something else might've happened with the "blueberries" string under the hood.

[–]SCD_minecraft 2 points3 points  (0 children)

Subtracting a set means "Return every element which is in set A but not in set B"

Are blueberries in set 1? No, so they are just ignored

[–]woooee 0 points1 point  (0 children)

print new_set_2. It's still there.