Skip to content

Instantly share code, notes, and snippets.

@reflechant
Created June 19, 2018 21:02
Show Gist options
  • Save reflechant/3b3aad80980bb19c8d666d708ed85b9b to your computer and use it in GitHub Desktop.
Save reflechant/3b3aad80980bb19c8d666d708ed85b9b to your computer and use it in GitHub Desktop.
from random import randint
mylist = [randint(10,20) for x in range(randint(10,15))]
print(*mylist)
even = [x for x in enumerate(mylist) if x[1] % 2 == 0]
for i in zip((x[0] for x in even), sorted(x[1] for x in even)):
mylist[i[0]] = i[1]
print(*mylist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment