I am working on a python exercise and here is the question:
Ask the user for a number and return a list that contains only elements from the original list a that are smaller than that number given by the user.
This is the original list:
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
I have the following code:
b = list()
num = raw_input('Give me a number: ')
for i in a:
if i < num:
b.append(i)
print b
But no matter what number I entered it always returns all numbers from the original list into the new list.
Any suggestion or comment?