Curso de Programación en Python/Set-5
Ir a la navegación
Ir a la búsqueda
Set-5.py
#!/usr/bin/python3
#-*-coding: utf-8 -*-
Set1 = { 1, "Gato", 3 }
Set2 = { 6, "Perro", "Gato", 4, 3 }
print( "Set1:", Set1 )
print( "Set2:", Set2 )
# Union the sets.
Set3 = Set1.union( Set2 )
print( "Set3:", Set3 )
Resultado
[rrc@Llawyr PythonClase]$ ./Set-5.py Set1: {1, 3, 'Gato'} Set2: {'Perro', 3, 4, 'Gato', 6} Set3: {1, 3, 4, 6, 'Gato', 'Perro'}