class Account():
def __init__(self, name, pwd, money=0):
self.name = name
self.pwd = pwd
self.money = money
def deposit(self, pwd, money):
if pwd == self.pwd:
if isinstance(money, (int, float)) and money >= 0:
self.money += money # self.money = money+money
print('您已成功粗那款%d元,卡上余额为%d元' % (money, self.money))
print('对不起,请输入正确的金额')
print('对不起,您的密码输入错误')
##功能
def func():
while True:
num1 = int(input('1.存款\n2.取款'))
if num1 == 1:
pwd3 = input('请输入密码:')
while pwd3 != pwd1:
print('密码输入错误')
pwd3 = input('请输入密码:')
else:
# eval() 当我们输入什么类型 就会返回什么类型 输入是int 返回int
moeny = eval(input('请输入金额:'))
a.deposit(pwd3, moeny)
li = []
while True:
print('登录银行系统')
num = int(input('1.注册账户\n2.登录\n3.退出\n 请输入您的选择:'))
if num == 1:
user = input('请输入用户名')
pwd1 = input('请输入密码')
pwd2 = input('请再次输入密码')
if pwd1 == pwd2:
li.append(user)
a = Account(user, pwd1)
print('恭喜您注册成功')
else:
print('对不起,您的两次密码输入不一致')
user = input('请输入用户名')
pwd1 = input('请输入密码')
pwd2 = input('请再次输入密码')
elif num == 2:
user1 = input('请输入用户名')
pwd3 = input('请输入密码')
if user1 in li:
if pwd3 == pwd1:
func()