Skip to content

Instantly share code, notes, and snippets.

@darthShadow
Last active August 29, 2015 14:19
Show Gist options
  • Save darthShadow/9425ab6dfffff515298d to your computer and use it in GitHub Desktop.
Save darthShadow/9425ab6dfffff515298d to your computer and use it in GitHub Desktop.
# Author : Anagh Kumar Baranwal
# Question : http://www.practicepython.org/exercise/2014/03/19/07-list-comprehensions.html
a = [1,4,9,16,25,36,49,64,81,100]
even_elements = [a[i] for i in range(0,len(a),2)]
print(even_elements)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment