Commit 7a78ea8c by BellCodeEditor

save project

parent 82eb6ff5
Showing with 11 additions and 3 deletions
...@@ -2,7 +2,7 @@ def new_input(): ...@@ -2,7 +2,7 @@ def new_input():
total = [] total = []
while True: while True:
money= input("请输入:") money= input("请输入:")
if unit== 'q': if money== 'q':
break break
else: else:
try: try:
...@@ -16,4 +16,12 @@ def new_input(): ...@@ -16,4 +16,12 @@ def new_input():
4 4
return total return total
result=new_input result=new_input
print(result) print(result)
\ No newline at end of file def sum(unit):
count=0
for i in unit:
count=count+i
return count
price=new_input()
pay=sum(price)
print("您一共消费了"+str(pay)+"元")
\ 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