Commit e91ab0ec by BellCodeEditor

auto save

parent 86730754
Showing with 17 additions and 0 deletions
'''
任务目标
1、定义一个递归函数,函数名自取;
2、函数接收一个n作为参数
3、能计算出第n列要波那契数列的值;
4、算出第几列斐波那契数列的值大于20
'''
def a(n):
if n <= 2:
return 1
else:
value = a(n-2)+a(n-1)
return value
print(a(9))
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