Skip to content

Instantly share code, notes, and snippets.

@tamert
Created September 9, 2020 20:05
Show Gist options
  • Save tamert/c0f81efd47971464ea181f008c02faa3 to your computer and use it in GitHub Desktop.
Save tamert/c0f81efd47971464ea181f008c02faa3 to your computer and use it in GitHub Desktop.
5_filter.py
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