实验七
class User():
name = 'guest'
password = '111'
def __init__(self, name, password):
self.name = name
self.password = password
self.status = 1
def info(self):
if self.status == 1:
print(self.name, self.password, '状态正常')
else:
print(self.name, self.password, '封禁')
def modify_password(self):
n = 0
while n < 3:
old = input('输入你的密码:')
if self.password != old:
print('密码错误')
n = n + 1
else:
new = input('输入你的新密码')
self.password = new
print(self.name,'密码修改成功')
break
else:
self.status = 0
print('账户已锁,请稍后再试')