<> How to use it python The realization of the front of Fibonacci sequence 100 individual

How to use it python The realization of the front of Fibonacci sequence 100 individual
First, analyze the topic
The realization of the front of Fibonacci sequence 100 individual , What is Fibonacci sequence ?
Fibonacci sequence (Fibonacci sequence), Also known as golden section series , Because the mathematician Leonardo · Fibonacci (Leonardoda
Fibonacci) Take rabbit breeding as an example , So it is also called “ Rabbit Series ”, It refers to such a sequence :**

<>0,1,1,2,3,5,8,13,21,34,……

* In Mathematics , Fibonacci sequence is defined recursively as follows :F(0)=0,F(1)=1, F(n)=F(n - 1)+F(n - 2)(n ≥ 2,n ∈ N)

<>0,1,0+1,1+1,1+2,2+3,3+5,5+8,8+13,13+21……

use for loop After that, we will use sequence unpacking
0,1, 1, 2, 3, 5, 8, 13, 21, 34,……
0,1,0+1,1+1,1+2,2+3,3+5,5+8,8+13,13+21……
a,b,a+b
b The value of is given a, a+b The value of is given b Keep cycling, keep printing a

<> code implementation

a = 0
b = 1
for i in range(100):
print(a, end=’ ')
a, b = b, a+b

<> I wish you all the best Python Study smoothly !

Technology