<> How to use python The first step of realizing Fibonacci sequence 100 individual

How to use python The first step of realizing Fibonacci sequence 100 individual
First, analyze the topic
The first step of realizing Fibonacci sequence 100 individual , What is the Fibonacci sequence ?
Fibonacci sequence （Fibonacci sequence）, Also known as the golden section sequence , Because mathematician Leonardo · Fibonacci （Leonardoda
Fibonacci） Introduced with rabbit breeding as an example , So it is also called “ Rabbit sequence ”, It refers to such a sequence of numbers ：**

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

* In Mathematics , The 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 Sequence unpacking will be used later
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 and printing a

<> code implementation

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

<> Good luck Python Study smoothly !

Technology
Daily Recommendation
views 2