-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEjercicio059.py
More file actions
35 lines (26 loc) · 831 Bytes
/
Ejercicio059.py
File metadata and controls
35 lines (26 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
EJERCICIO 59: Unión de listas sin duplicación
Escribir una función unionLista(L1,L2,L3) que toma como parámetros tres litas de enteros L1, L2 y L3, y devuelve
una lista en orden ascendente que representa la unión de estas tres listas sin duplicación de números.
Pruebas de verificación:
>> unionLista([3,6,9,3],[1,0,3],[12,6,0])
[0,1,3,6,9,12]
>> unionLista([7,44,-3],[],[7,2,7])
[-3,2,7,44]
'''
from wsgiref.util import request_uri
def unionLista(L1,L2,L3):
lista = []
for i in L1:
if i not in lista:
lista.append(i)
for i in L2:
if i not in lista:
lista.append(i)
for i in L3:
if i not in lista:
lista.append(i)
lista.sort()
return lista
print(unionLista([3,6,9,3],[1,0,3],[12,6,0]))
print(unionLista([7,44,-3],[],[7,2,7]))