Created
March 29, 2020 19:11
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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