print(’-----欢迎使用XXX自动取款机-----’)
count = 1
money = 1000
userAccount = ‘123456’
userPasswd = ‘654321’
while count <= 3:
account = input(‘请输入账号:’)
passwd = input(‘请输入密码:’)
if account == userAccount and passwd == userPasswd:
print(‘请选择接下来您要进行的操作:’)
while True:
print(‘1、取款’)
print(‘2、存款’)
print(‘3、查询’)
print(‘4、退出’)
choice = input()
if choice == ‘1’:
print(‘您选择了取款功能’)
while True:#取款循环
print(‘请输入您要取款的金额:’)
take = int(input())
if take % 100 == 0:#判断取款金额是否是100的倍数
if money >= take:#余额是否满足
money = money - take#计算取钱之后的余额
print(‘取款%d元,余额%d元’%(take,money))
break
else:
print(‘余额不足’)
break
else:
print(‘取现金额只能是100的倍数,请重新输入’)
elif choice == '2':
print('您选择了存款功能')
while True:
store = int(input('请把纸币整齐放入存钞口:'))
if store % 100 == 0:
money += store
print('当前余额:%d'%money)
break
else:
print('不能放入除100以外的纸币')
elif choice == '3':
print('您选择了查询功能')
print('当前余额:%d'%money )
elif choice == '4':
print('请收好您的银行卡')
break#打断的是功能选择循环
else:
print('输入有误,请重新选择:')
break#密码次数循环
else:
if count != 3:
print('账号或密码错误,您还有%d次机会!'%(3-count))
else:
print('您当日已输错三次密码,请明日再试!')
count+=1