Commit a9f1d397 by BellCodeEditor

save project

parent b830784b
Showing with 8 additions and 13 deletions
def new_input():
total = []
while True:
money= input("请输入:")
if money == 'q':
unit= input("请输入:")
if unit== 'q':
break
else:
try:
money=int(money)
unit=int(unit)
except:
print("应输入整数")
else:
total.append(money)
total.append(unit)
new_unit=int(unit)
return total
def abc(list1):
count=0
for i in range(list1):
count+= i
return count
result=new_input()
pay=abc(result)
print("一共需要付",pay,"元")
\ No newline at end of file
list1=new_input()
print(list1)
\ 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