Commit ba985561 by BellCodeEditor

auto save

parent cfeede31
Showing with 38 additions and 6 deletions
def new_input(): def new_input():
total = [] total = []
whil = True while True:
unit = input unit = new_input
if unit == "p" if unit == "q":
break break
else: else:
try: try:
...@@ -12,11 +12,17 @@ def new_input(): ...@@ -12,11 +12,17 @@ def new_input():
else: else:
total.append(unit) total.append(unit)
print("-"*30) print("-"*30)
print(total) return total
def sum(money):
count = 0
for i in money:
count = count+i
return count
a =new_input()
b = sum(a)
print("一共消费了"+str(b))
new_input()
def
......
def new_input():
total = []
while True:
unit = new_input
if unit == "q":
break
else:
try:
unit = int(unit)
except:
print("ujfhhg")
else:
total.append(unit)
print("-"*30)
return total
def sum(money):
count = 0
for i in money:
count = count+i
return count
a =new_input()
b = sum(a)
print("一共消费了"+str(b))
\ 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