Skip to content

Instantly share code, notes, and snippets.

@plavjanik
Last active June 16, 2022 08:46
Show Gist options
  • Save plavjanik/10e2d76306f8671dbd88b7daf1bfaf64 to your computer and use it in GitHub Desktop.
Save plavjanik/10e2d76306f8671dbd88b7daf1bfaf64 to your computer and use it in GitHub Desktop.
Looping in sorted order
colors = ["cyan", "magenta", "yellow", "black"]
for color in sorted(colors):
print(color)
for color in sorted(colors, reverse=True):
print(color)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment