Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNoah Fields
13,985 Points"Except", not XOR?
I thought the term for finding all instances belong in Set A, and all instances which belong in Set B, but not any instances that belong to both A and B, was referred to as an Exclusive Or, or XOR for short. Here, it's referred to as an "except". Am I incorrect? Are there certain instances which one of the two terms is more accurate or correct? What difference, if any, is there between the meaning of the two terms?
1 Answer
Steven Parker
231,236 PointsEXCEPT is not the same concept as XOR.
Both would return items from set A that are not in set B. But XOR would also return items from set B that are not in set A, where EXCEPT would not return any items from set B at all.
In set theory, this is called a "difference". The set theory equivalent of XOR is a "symmetric difference".
Missy Kailet
4,475 PointsMissy Kailet
4,475 PointsA quick question on this response: Does that mean that on the example used in the course for Apple People and Banana People, the Except column would return only Jan and Stacey, and not Jan, Stacey, and Dante? I'm just trying to make sure I understand, as it seems from your answer that the examples shown in the lesson were for XOR, not EXCEPT.
Steven Parker
231,236 PointsSteven Parker
231,236 PointsYes, that's right. I don't know of any set operator that performs what is shown in that video. But here's an example showing what an
EXCEPT
actually does:I submitted a bug report about the video to the support folks.