# File: ChapterLists/filterPred.py """ Remove negative numbers [-3, -2, 2, 3, 4] """ def removeNegative(x): # remove all the negative numbers return x >= 0 def main(): M = [2,3,-4,5,-1] M1 = list(filter(removeNegative, M)) print(M,'After removing negative ints:',M1) M2 = [ x for x in M if x > 0 ] print(M,'After removing negative ints:',M2) main()