Commit 85ffae3e by BellCodeEditor

save project

parent 40eb12f4
Showing with 36 additions and 0 deletions
......@@ -3,3 +3,38 @@
#要求这个函数能计算1+2+3+……+num的结果
#q = int(input("天:"))
#a = 1
#b = 1
#for i in range(0,q):
#c = 2*(a+b)
#a = c
#print(a)
def a(n):
if n == 1:
return 1
else:
return n + a(n-1)
#w = a(10)
r = int(input("数"))
#print(a)
#print(c)
#print("得",a)
if r==1:
print(1)
else:
a = r-1
s=[]
for i in range(0,r-1):
s.append(i)
c = a+s
print(c)
print(s)
\ 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