aList = [1, 2, 3, 4, 5, 6, 7, 8, 9]low = 3high = 7print filter(lambda x, l=low, h=high: h>x>l, aList) # returns: [4, 5, 6]