def fibs(num):
result = [0,1]
for i in range(num-2):
result.append(result[-2]+result[-1])
return result
>>> fibs(10)
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
a,b=0,1
while b <10:
print b,
a,b = b,a+b
>>>
1 1 2 3 5 8