“Establecer operadores” Código de respuesta

Establecer operadores

Ops 		P	⨯	 \	 =	 ≠
Front 		⊂	⊄	⊆	⊈	⊊ 
Back 		⊃	⊅	⊇	⊉	⊋
Inside 		∀	∃	∊	∍
Objects 	∅	∞	∆	∇
Category of Frogs

Establecer operadores

>>> a = {1, 2, 3, 4, 5, 6}
>>> b = {4, 5, 6, 7, 8, 9}
>>>
>>> a.update(b)          # a "union" operation
>>> a
{1, 2, 3, 4, 5, 6, 7, 8, 9}
>>>
>>> a &= b               # the "intersection" operation
>>> a
{4, 5, 6, 7, 8, 9}
>>>
>>> a -= set((7, 8, 9))  # the "difference" operation
>>> a
{4, 5, 6}
>>>
>>> a ^= b               # the "symmetric difference" operation
>>> a
{7, 8, 9}
Comfortable Centipede

Respuestas similares a “Establecer operadores”

Preguntas similares a “Establecer operadores”

Más respuestas relacionadas con “Establecer operadores” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código