Commit e388df52 by BellCodeEditor

auto save

parent 0cd3f3d6
Showing with 2 additions and 29 deletions
def new_input():
total=[] \ No newline at end of file
while True:
data=input('请输入价格')
if data=='q':
break
else:
try:
data1=int(data)
except:
print('请输入数字')
else:
total.append(data1)
print(total)
return total
result1=new_input()
print(result1)
def count(list):
a=0
for i in list:
a=a+i
#print("价格总和是"+str(a))
return a
result2=count(result1)
print(result2)
\ 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