#模擬銀行存取款
card1="1001"
pwd1="123456"
ban1=10000
card2="1002"
pwd2="12345"
ban2=20000
card3="1003"
pwd3="1234"
ban3=30000
times=0
print("歡迎使用樂樂銀行!")
while True:
ban=0
card=input("請輸入卡號:")
pwd=input("請輸入密碼:")
if card==card1 and pwd==pwd1:
ban=ban1
elif card==card2 and pwd==pwd2:
ban=ban2
elif card==card3 and pwd==pwd3:
ban=ban3
else:
times=times+1
if times>=3:
print("您輸入的密碼已超過3次,請聯繫櫃檯!")
break
else:
print("卡號和密碼錯誤!")
continue
while True:
num=input("請輸入要辦理的業務:1.存款 2.取款 3.退卡")
if num=="1":
inn=float(input("請輸入存款金額:"))
if inn<=0:
print("請輸入大於0的存款金額!")
else:
ban=ban+inn
print("存款成功!存入:",inn,"餘額:",ban)
elif num=="2":
out=float(input("請輸入取款金額:"))
if out<=0:
print("請輸入大於0的取款金額!")
elif out>ban:
print("餘額不足!")
continue
else:
ban=ban-out
print("取款成功!取出:",out,"餘額:",ban)
elif num=="3":
print("請收好卡片!")
break
else:
print("您輸入有誤!請重新輸入!")
continue