table of Contents
Getting Started with Python practice
Getting Started with Python practice
Title: Output the first N Fibonacci numbers columns.
Program Analysis: Fibonacci number (Fibonacci sequence), also known as golden columns, referring to such a series: 0,1,1,2,3,5,8,13,21,34, this series ...... from the beginning of paragraph 3, each of which is equal to the sum of the first two
m=5
a1=0
a2=1
i=0
while i<m:
a3=a1+a2
a1=a2
a2=a3
i=i+1
print(a3)
#输出前N个斐波那契数列
N=int(input('请输入第N个(>3的)斐波那契数列:'))
list1=[0,1]
a1=0
a2=1
i=0
while i<N:
a3=a1+a2
a1=a2
a2=a3
i=i+1
list1.append(a3)
print(list1)