class User(object):
def __init__(self, first_name, last_name, login_attempts):
self.first_name = first_name
self.last_name = last_name
self.login_attempts = login_attempts
def increment_login_attempts(self, miles):
'''递增'''
self.login_attempts += miles
def reset_login_attempts(self):
'''重置'''
self.login_attempts = 0
def read_login_attempts(self):
'''打印'''
print self.first_name + ' ' + self.last_name + ' ' + 'this is ' + str(self.login_attempts)
user = User('xiao', 'ming', 5)
user.increment_login_attempts(10)
user.read_login_attempts()
user.increment_login_attempts(10)
user.read_login_attempts()
user.increment_login_attempts(10)
user.read_login_attempts()
user.reset_login_attempts()
user.read_login_attempts()