+ 2

can someone explain this code? thanks😊

a = {"a", "b", "c", "d"} b = {"b", "d", "e"} c = {"e", "b", "a"} print((b^c) - a)

9th Oct 2020, 5:50 PM
Đ–Đ”ĐœŃ‘Đș
Đ–Đ”ĐœŃ‘Đș - avatar
6 Answers
+ 4
These are sets B intersection C i.e elements that are present in either B or C but not in both In this case, Result would be d,a (B intersection C) - A i.e remove all elements that are present in A from (B intersection C) In this case, d and a are both present in A so both are removed and we are left with a null set edit: ^ is called **symmetric difference** not intersection
9th Oct 2020, 6:03 PM
‎ ‏‏‎Anonymous Guy
9th Oct 2020, 6:03 PM
Julia Shabanova
Julia Shabanova - avatar
+ 3
When elements are in a curly bracket with no key-value pair, then it's a set. ^ is a set operation (intersection)
10th Oct 2020, 2:13 AM
Eedriz_
Eedriz_ - avatar
+ 3
The caret ^ means intersection. and the variables a, b, and c are sets. Sets are like lists but unordered and set elements are immutable and each Element is unique. So the above means all elements common to both sets b and c but not in a.
10th Oct 2020, 8:13 PM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
+ 2
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2464/ a, b, and c here are sets. (b^c) is a set that contains elements that are in b and c but not both. ((b^c) - a) is a set containing elements in (b^c) that are not in a.
9th Oct 2020, 6:06 PM
Zerokles
Zerokles - avatar
+ 2
thank u all very muchđŸ˜ș
9th Oct 2020, 6:53 PM
Đ–Đ”ĐœŃ‘Đș
Đ–Đ”ĐœŃ‘Đș - avatar