a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] def smallerThan(list, number=False): # if no number is provided in function call (e.g. smallerThan(a)), ask the user for one if not number: number = float(raw_input("What number should the numbers in the new list be smaller than? ")) # create an empty list where the new numbers will be stored newList = [] # iterate over each number (num) in the original list ("list" is and argument in the function definition) for num in list: # if the current number is smaller than the "number" argument, store it in the new list if num < number: newList.append(num) return newList print smallerThan([4, 8, 93, 763, 34], 50)