Commit d3ba4937 by BellCodeEditor

save project

parent 25912088
Showing with 13 additions and 11 deletions
total = [] total = []
def new_price(a): def new_price():
while True: while True:
unit= input("请输入:") unit= input("请输入:")
if unit== 'q': if unit== 'q':
...@@ -8,21 +8,23 @@ def new_price(a): ...@@ -8,21 +8,23 @@ def new_price(a):
else: else:
try: try:
unit=int(unit) unit=int(unit)
a.append(unit)
except: except:
print("程序错误") print("程序错误")
break break
else:
total.append(unit)
return total return total
w=new_price(total) a = new_price()
def sum(list) print(a)
b=0 def sum(list):
for i in list(): b=0
for i in list:
b+=i b+=i
return list return b
c=sum(total) c=sum(a)
print(c) print(c)
# print(total)
s=new_price(total)
print(s)
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