-
-
Save parzibyte/355974a905cc5d953cf964ab2e75c792 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; uno con sort y otro con sorted para demostrar el orden inverso | |
nombres_ordenados = sorted(nombres, reverse=True) | |
edades.sort(reverse=True) | |
print("Nombres ordenados: ") | |
print(nombres_ordenados) | |
print("Edades ordenadas: ") | |
print(edades) | |
""" | |
Salida: | |
Nombres originalmente: | |
['Luis', 'María', 'Pedro', 'Mario', 'Leon', 'Claire'] | |
Edades originalmente: | |
[6, 23, 6, 1, 2, 3, 4] | |
Nombres ordenados: | |
['Pedro', 'María', 'Mario', 'Luis', 'Leon', 'Claire'] | |
Edades ordenadas: | |
[23, 6, 6, 4, 3, 2, 1] | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment