python3.6项目:银行存取款系统
card1 ="1001"#卡号
pwd1="1001"#密码
ban1=10000#余额
card2 ="1002"
pwd2="1002"
ban2=12000
card3 ="1003"
pwd3="1003"
ban3=14000
time1=0#输入错误次数
time2=3#剩余输入次数
while True:
time1=time1+1
time2=3-time1
print("欢迎来到未来银行")
card=input("请输入您的卡号:")
pwd=input("请输入您的密码:")
ban=0#余额
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:
print("您已经第",time1,"次输错了,还有",time2,"机会")
if time1>=3:
print("三次输错卡已冻结,请联系柜台!")
break
print("密码错误,请重新输入")
continue
while True:
num=input("请输入要办理的业务:1.存款 2.取款 3.退卡")
if num=="1":
cun=float(input("请输入存款金额:"))
if cun<=0:
print("存款请大于0!")
else:
ban=cun+ban
print("存款成功,存入:",cun,"余额:",ban)
elif num=="2":
qu=float(input("请输入取款金额:"))
if qu<=0:
print("取款请大于0!")
else:
ban=ban-qu
print("取款成功,取出:",qu,"余额:",ban)
elif num=="3":
print("退卡成功,请取卡!")
break
else:
print("无此业务,请重新输入!")
continue