Commit 2489bfde by BellCodeEditor

save project

parent 05e7d622
import func
a=func.put_money()
b=func.get_allmoney(a)
print("分数为"+str(b))
# total = []
# while True:
# unit= input("请输入:")
# if unit== 'q':
# break
# else:
# total.append(unit)
# print(total)
def put_money():
wallet=[]
while True:
money=input("输入整数价格(按'q'结算):")
if money=="q":
print("已退出")
break
try:
int(money)
wallet.append(money)
print("当前钱包内有:"+str(",".join(wallet)))
except:
print("记得输入整数")
print("-"*30)
print("结算:")
print("当前钱包内有"+str(",".join(wallet)))
return wallet
result_wallet=put_money()
#print(result_wallet)
def get_allmoney(list):
all_money=0
for i in list:
all_money=all_money+int(i)
return all_money
result_getallmoney=get_allmoney(result_wallet)
print("总和为:"+str(result_getallmoney))
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