One approach
def filterList(numList, threshold):
return list(filter(lambda x: x < threshold, numList))
Another approach:
filteredList = [x for x in numList if x < threshold]
0
solved How do I return a list of numbers below a certain threshold without using complex list functions? [closed]