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(): def totol():
total = [] total = []
while True: while True:
unit= input("请输入:") unit= input("请输入(输入q退出):")
if unit== 'q': if unit== 'q':
break break
else: else:
...@@ -12,5 +11,13 @@ def totol(): ...@@ -12,5 +11,13 @@ def totol():
print("请重新输入一个整数") print("请重新输入一个整数")
else: else:
total.append(unit) total.append(unit)
print(total) #print(total)
totol() return total
\ No newline at end of file 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