+ 3

Python - What does {1|2}|{1}|{2} mean?

zzz = {1|2}|{1}|{2} print(zzz) How did we get {1,2,3} as the output?

24th Sep 2020, 11:49 PM
Solus
Solus - avatar
1 Answer
+ 7
1|2 = 3 bitwise or | 01 10 -------- 11 The union operator | combines two sets to form a new one containing items in either. {3} | {1, 2} = {1, 2, 3} https://www.sololearn.com/learn/4073/?ref=app
25th Sep 2020, 12:33 AM
Vitaly Sokol
Vitaly Sokol - avatar