# Exercise 9-5 Login Attempts # Learning Objective: Increment and Modify a method within a class. class Users: def __init__(self, first_name, last_name, dob, state, hair_color): """Initialize User Profile variables""" self.first_name = first_name self.last_name = last_name self.dob = dob self.state = state self.hair_color = hair_color self.login_attempts = 0 def describe_user(self): """Prints descriptions of user based on inputs""" print(f"{self.first_name} {self.last_name} was born on {self.dob}, they live in {self.state} and they have {self.hair_color}") def greet_user(self): """Prints personalized greeting to user specified""" print(f"Welcome to this python program, {self.first_name} {self.last_name}!") def increment_login_attempts(self): """Increments Login Attempts by one""" self.login_attempts += 1 def reset_login_attempts(self): """Resets login attempts to zero""" self.login_attempts = 0 jang = Users("Jan", "Greetch", "05/23/92", "NJ", "Purple") prompt = "How many time to attempt to login?\n" for i in range(int(input(prompt))): jang.increment_login_attempts() print(f"{jang.login_attempts} login attempts have been made for the account {jang.first_name}") jang.reset_login_attempts() print(f"Login attempts for {jang.first_name} {jang.last_name} have been reset to {jang.login_attempts}.")