Commit dbcb829b by BellCodeEditor

auto save

parent 578e41ee
def m(ab):
cont=0
for i in ab:
cont+=i
return cont
print(m([1,2,3,4,5]))
print(sum([1,2,3,4,5])) #sum()求一个数字序列中所有数字的和
\ No newline at end of file
import ab
total = [] #封装成price()函数
while True: def price():
unit= input("请输入:") total = []
if unit== 'q': while True:
break unit= input("请输入:")
else: if unit== 'q':
total.append(unit) break
print(total) else:
\ No newline at end of file try:
unit = int(unit)
except:
print('请输入整数')
else:
total.append(unit)
return total
#print(sum(price()))
\ 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