1 . 進入 repl.it 線上 ptyhon 網站,可用Google帳號登入
1 . 進入 repl.it 線上 ptyhon 網站,可用Google帳號登入
sum=0
n=0
while True:
momey=input("請輸入金額 : ")
if momey=="q":
print("共計 ",n," 筆,總金額共 : ",sum," 元")
break
else:
sum +=int(momey)
n += 1
# 以下為折扣計算......
if sum>=3000:
discount=0.8
elif sum>=2000:
discount=0.9
elif sum>=1000:
discount=0.95
else:
discount=1
# 輸出折扣後金額......去掉小數點
sum=round(sum*discount)
print("結帳金額折扣後為: ",sum," 元")