Commit 3a915c1d by BellCodeEditor

save project

parent dc70412a
Showing with 44 additions and 0 deletions
def q():
s=[0.01,0.02,0.05,0.1,0.2,0.5,1.0]
while True:
try:
w=float(input("请输入要找的零钱:"))
if w<=0:
print("请输入正数")
else:
break
except:
print("请输入小数")
i=len(s)-1
while i>=0:
if w >=s[i]:
n=int(w/s[i])
w=float("{:.2f}".format(w-n*s[i]))
print("找了{}个{}元硬币".format(n,s[i]))
i-=1
q()
w=0
def new_input():
total = []
while True:
unit=input("请输入:")
if unit=='q':
break
else:
try:
unit=int(unit)
except:
print("请输入数字")
else:
total.append(unit)
# print(total)
return total
qw=new_input()
#new_input()
for i in qw:
w+=i
print(w)
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