Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deep18-03/906b76c1ff4d5bbcda2ab1677a14854d to your computer and use it in GitHub Desktop.
Save Deep18-03/906b76c1ff4d5bbcda2ab1677a14854d to your computer and use it in GitHub Desktop.
created a python program to create a new list that has only even element from old list using list compresion #singleline code
'''
1.create a list using range()
2.use list comprehension concept
'''
a=list(range(1,11))
print=([a for a in a if a%2==0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment