菜農Python菜鳥學習筆記lambda學習

#! -*- coding:utf-8 -*-
#Python菜鳥lambda學習
#菜農[email protected] 2019.4.16
filter_me = [1, 2, 3, 4, 6, 7, 8, 11, 12, 14, 15, 19, 22]
result = filter(lambda x: x % 2 == 0, filter_me)
res = filter(lambda x: x & 1 > 0, filter_me)
for i in filter(lambda x: x & 1, range(10)):
    print(i)
    
print(*res)
print(*result)
print(filter_me)
print(*filter_me)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章