1def fib(num):
2 a = 0
3 b = 1
4 for i in range(num):
5 yield a
6 temp = a
7 a = b
8 b = temp + b
9
10
11for x in fib(100):
12 print(x)
13
14
15def fib2(num): # Creates fib numbers in a list
16 a = 0
17 b = 1
18 result = []
19 for i in range(num):
20 result.append(a)
21 temp = a
22 a = b
23 b = temp + b
24 return result
25
26
27print(fib2(100))
28
1number1 = 0
2print('1:', number1)
3number2 = 1
4for count in range(2, 101):
5 print(count, ':', number1 + number2)
6 number1 += number2
7 number2 = number1 - number2