過濾功能

過濾器需要一個函式和一個集合。它返回函式返回 True 的每個項的集合。

arr=[1,2,3,4,5,6]
[i for i in filter(lambda x:x>4,arr)]    # outputs[5,6]