Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Solución reto #23 Python #1365

Open
grisales54 opened this issue Oct 1, 2024 · 0 comments
Open

Solución reto #23 Python #1365

grisales54 opened this issue Oct 1, 2024 · 0 comments

Comments

@grisales54
Copy link

`def listas(lista1, lista2, bool: bool = True):

if bool:
    comunes = []
    for i in lista1:

        if i in lista2:
            comunes.append(i)

    return comunes

else:
    no_comunes = []
    for i in lista1:

        if i not in lista2:
            no_comunes.append(i)

    return no_comunes

lista = [1, 2, 3, 4, 5, 6]
lista_2 = [4, 3, 1, 12]

print(listas(lista, lista_2))
print(listas(lista, lista_2, False))

lista = ["manzana", "pera", "uva"]
lista_2 = ["manzana", "uva"]

print(listas(lista, lista_2))
print(listas(lista, lista_2, False))
`

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant