vaga python

mail@pastecode.io avatar
unknown
python
2 years ago
516 B
1
Indexable
Never
a = [1, 2, 3 , 4]
b = [1, 3, 4, 5, 6, 7]
c = [3, 6, 8, 9, 10]

expected = [1, 2, 3, 4 ,5 ,6 , 7 , 8, 9, 10]

def merge(*listas):
    merged = []
    for lista in listas:
        for i in lista:
            if not i in merged:
                merged.append(i)
    merged.sort()
    return merged

def test(lista):
    if lista == expected:
        return 'Aprovado!'
    return 'Lista invalida!'

nova_lista = merge(a, b, c)
print('lista gerada: ', nova_lista)
print('Teste: ', test(nova_lista))