-
-
Save parzibyte/561f8e8ac027b93372c8e4e2e775dec2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://parzibyte.me/blog | |
nombres = ["Luis", "María", "Pedro", "Mario", "Leon", "Claire"] | |
edades = [6, 23, 6, 1, 2, 3, 4] | |
print("Nombres originalmente: ") | |
print(nombres) | |
print("Edades originalmente: ") | |
print(edades) | |
# Los ordenamos. sorted los ordena y devuelve | |
nombres_ordenados = sorted(nombres) | |
edades_ordenadas = sorted(edades) | |
print("Nombres ordenados: ") | |
print(nombres_ordenados) | |
print("Edades ordenadas: ") | |
print(edades_ordenadas) | |
""" | |
Salida: | |
Nombres originalmente: | |
['Luis', 'María', 'Pedro', 'Mario', 'Leon', 'Claire'] | |
Edades originalmente: | |
[6, 23, 6, 1, 2, 3, 4] | |
Nombres ordenados: | |
['Claire', 'Leon', 'Luis', 'Mario', 'María', 'Pedro'] | |
Edades ordenadas: | |
[1, 2, 3, 4, 6, 6, 23] | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment