Created
September 9, 2020 20:05
-
-
Save tamert/c0f81efd47971464ea181f008c02faa3 to your computer and use it in GitHub Desktop.
5_filter.py
This file contains hidden or 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
liste = [1,2,3,4,5,6,7,8,9,10] | |
def cift(sayi): | |
return sayi%2==0 | |
print(list(filter(cift, liste))) | |
# out: [2, 4, 6, 8, 10] | |
# yada lambda terimi ile kullanalım | |
print(list(filter(lambda sayi: sayi%2==0, liste))) | |
# out: [2, 4, 6, 8, 10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment