+ 2

Que hace el | ? (Python)

Soy nuevo en Python, y me gustaría que alguien me ayudara.

22nd Mar 2022, 10:23 PM
Pablo PC
Pablo PC - avatar
1 Réponse
+ 2
Check these operators first = {2, 3, 3, 5, 9, 7} second = {4, 5, 6, 7, 8} print(first | second) print(first & second) print(first - second) print(second - first) print(first ^ second) output: {2, 3, 4, 5, 6, 7, 8, 9} {5, 7} {9, 2, 3} {8, 4, 6} {2, 3, 4, 6, 8, 9} #(first | second) - return added without duplicates #(first & second) - return what is common in both #(first - second) - return what is unique in first #(second - first) - return what is unique in second #(first ^ second) - return what is unique in both
22nd Mar 2022, 11:45 PM
Antonio Torres
Antonio Torres - avatar