Commit db428c02 by BellCodeEditor

auto save

parent b16f38f3
Showing with 20 additions and 0 deletions
def sum(n):
if n == 1:
return 1
a = n+sum(n-1)
return a
print(sum(5))
\ No newline at end of file
def func(n):
if n <= 2:
return 1
else:
value = func(n-1)+func(n-2)
return value
n=3
while True:
if func(n) > 2000:
print('第',n,'列斐波那契数列的值大于2000')
break
n += 1
\ No newline at end of file
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