Commit 65fc1ec6 by BellCodeEditor

save project

parent 05e7d622
def new_input():
total = []
while True:
w=input("请输入(q退出):")
if w=="q":
break
else:
try:
w=int(w)
except:
print("请输入一个数字")
else:
total.append(w)
return total
def sum(money):
count=0
for i in money:
count=count+i
return count
result=new_input()
z=sum(result)
print("一共消费"+str(z)+"元")
\ No newline at end of file
import func
s=func.new_input()
x=func.sum(s)
print("总分是"+str(x))
\ 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