Skip to content

Instantly share code, notes, and snippets.

@RicardoTurco
Created March 4, 2020 13:26
Show Gist options
  • Save RicardoTurco/9227760f00e876355c5b0ead7b61a016 to your computer and use it in GitHub Desktop.
Save RicardoTurco/9227760f00e876355c5b0ead7b61a016 to your computer and use it in GitHub Desktop.
Python: Iterando listas com índice negativo
st = list('gooogle')
# ['g', 'o', 'o', 'o', 'g', 'l', 'e']
# Estamos iterando a lista "st" na ordem inversa ...
for x in range((len(st)-1), (0-1), -1):
print(st[x])
# Result
e
l
g
o
o
o
g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment