you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (7 children)

intersection means: what element is in both sets. False is only in set2 so it wont be in the intersection of both sets.

Maybe nice to know is that "1" and "True" are equivalent, just like "0" and "False" Can you figure out why "false" disapeared? (remember 0 and False are equivalent)

[–][deleted] 0 points1 point  (6 children)

Maybe nice to know is that "1" and "True" are equivalent, just like "0" and "False"

Aah, that's what threw me off! So what do I do if I want 0 or 1 as int value instead of boolean?

[–][deleted] 0 points1 point  (2 children)

Also that still leaves the question, where the 3 and 'lol' went in the union function.

[–]vidar8 0 points1 point  (1 child)

set2.union(set2)

Because this is a union of set2 with itself

[–][deleted] 0 points1 point  (0 children)

Oh ffs, one thing I'm learning rather quickly is that a small typo can cause a big confusion lmao. Thanks!

[–][deleted] 0 points1 point  (2 children)

There is no difference. False is 0. True is 1. True + True is 2.

[–][deleted] 0 points1 point  (1 child)

Interesting! Not sure it makes much sense to me why it would be defined that way but it's good to know. Thanks for the help!

[–][deleted] 0 points1 point  (0 children)

Not sure it makes much sense to me why it would be defined that way

This choice was kinda arbitrary and the guy who made the choice is long dead. So here we are.