Commit eb3fd469 by BellCodeEditor

save project

parent ae6f1a05
def new_input(): def new_input():
total = [] total=[]
while True: while True:
unit= input("请输入:") unit= input("请输入:")
if unit== 'q': if unit== 'q':
break break
else:
try:
unit=int(unit)
except:
print("请重新输入一个数字")
else: else:
try: total.append(unit)
unit=int(unit) finally:
except: print("==================")
print("请重新输入一个数字") return total
else: #def sum(money):
total.append(unit) #count=0
finally: #for i in money:
print("==================") #count=count+1
return total #return count
def sum(money): #price=new_input()
count=0 #pay=sum(price)
for i in money: #print("您一共支付"+str(pay)+"元")
count=count+1 \ No newline at end of file
return count
price=new_input()
pay=sum(price)
print("您一共支付"+str(pay)+"元")
\ No newline at end of file
import func
data=func.new_input()
score=func.sum(data)
print("你的分数是"+str(score))
\ 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