Commit 86e7660d by BellCodeEditor

save project

parent 5f8ae778
def sum(a):
s=0
for i in range(a+1):
s=s+i
return s
result = sum(3)
print(result)
\ No newline at end of file
def max(a,b):
if a>b:
return a
else:
return b
result = max(6,7)
print(result)
\ No newline at end of file
def sum(x,y):
s = x + y
return s
result = sum(3,5)
print(result)
\ No newline at end of file
s = 0
while True:
num = input("请输入整数(q结束)")
if num =="q":
break
try:
int_sum = int(num)
except:
print("无效字符,请重新输入一个整数!")
else:
s = s+int_sum
print("输入数字的总和为:",s)
\ No newline at end of file
def new_input(): "C:\Program Files (x86)\Tencent\WeChat"
total=[] \ No newline at end of file
while True:
unit=input('请输入(s退出)')
if unit=='s'
break
else:
tolal.append(unit)
print(total)
new_input()
\ 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