Commit a62d1533 by BellCodeEditor

save project

parent 03370a98
Showing with 0 additions and 19 deletions
......@@ -14,25 +14,6 @@ while True:
i+=1
def recur_fibo(n):
"""递归函数
输出斐波那契数列"""
if n <= 1:
return n
else:
return(recur_fibo(n-1) + recur_fibo(n-2))
# 获取用户输入
nterms = int(input("您要输出几项? "))
# 检查输入的数字是否正确
if nterms <= 0:
print("输入正数")
else:
print("斐波那契数列:")
for i in range(nterms):
print(recur_fibo(i))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment