Skip to content

Instantly share code, notes, and snippets.

@anonur
Created April 4, 2019 19:21
Show Gist options
  • Save anonur/650467848dcdcacf997a6a65beceab76 to your computer and use it in GitHub Desktop.
Save anonur/650467848dcdcacf997a6a65beceab76 to your computer and use it in GitHub Desktop.
Loop over a slice copy of the entire list with insert() function
words = ['cat', 'dog', 'people']
for w in words:
if len(w) > 6:
words.insert(0, w)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment