Commit 8520e8a8 by BellCodeEditor

auto save

parent 40eb12f4
Showing with 24 additions and 0 deletions
...@@ -3,3 +3,27 @@ ...@@ -3,3 +3,27 @@
#要求这个函数能计算1+2+3+……+num的结果 #要求这个函数能计算1+2+3+……+num的结果
def sun_numbers(num):
if num==1:
return 1
sum=sun_numbers
return sum
print(sun_numbers(2))
def func(n):
if n<2:
return 1
else:
sum=n*func(n-1)
return sum
"""for i in range(1,10):
if func(i)>20:
print(i)"""
print(func(4))
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