Created
January 18, 2021 16:05
-
-
Save BetterProgramming/7ff050ce032c662f0c09e4db3a0344fe to your computer and use it in GitHub Desktop.
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
def even(x): | |
if x%2==0: | |
return True | |
num1=[1,2,3,4,5,6,7,8,9,10] | |
result=filter(even,num1) | |
print (result)#Output:<filter object at 0x00E5E4D8> | |
print (next(result)) | |
#Output: 2 | |
print (next(result)) | |
#Output: 4 | |
print (next(result)) | |
#Output: 6 | |
print (next(result)) | |
#Output: 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment