Commit 17948955 by BellCodeEditor

auto save

parent 028525cc
import func
a=func.totol
c=b(a)
print("您总共消费",c,"元")
\ No newline at end of file
def totol():
total = []
while True:
unit= input("请输入:")
unit= input("请输入(输入q退出):")
if unit== 'q':
break
else:
......@@ -12,5 +11,13 @@ def totol():
print("请重新输入一个整数")
else:
total.append(unit)
print(total)
totol()
\ No newline at end of file
#print(total)
return total
def b(c):
sum=0
for i in c:
sum=sum+i
return sum
#a=totol()
#c=b(a)
#print("总和是",c)
\ 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