使用python模拟取款,主要是程序逻辑
account ="123456789"
name = "X"
password = "12345678"
money = 1000
print("账户:" + account + ",\t用户名:" + name + ",\t存款余额:" + str(money))
print("\n")
esc = "否"
while esc == "否":
account2 = input("请输入您的账号:")
password2 = input("请输入您的密码:")
if (account2 == account and password2 == password):
finish = "no"
while finish == "no":
money2 = input("请输入你要取的金额:")
if (int(money2) <= money):
money = money-int(money2)
print("取款成功!当前余额:" + str(money))
esc = input("是否退出?(是/否)")
if esc == "是":
finish = "yes"
else:
print("余额不足,请充值!")
else:
print("账户或密码不正确,请检查后再试。")