-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page166.py
More file actions
51 lines (34 loc) · 1.53 KB
/
python_exercise_page166.py
File metadata and controls
51 lines (34 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# esercizio numero 9.4 pagina 166
class User:
def __init__(self, first_name, last_name, email_address, phone_number, ID_card_number):
self.first_name = first_name
self.last_name = last_name
self.email_address = email_address
self.phone_number = phone_number
self.ID_card_number = ID_card_number
self.user_attempts = 0 # Initialize login_attempts to 0
def describe_user(self):
print(f"Your first name is {self.first_name}.")
print(f"Your last name is {self.last_name}.")
print(f"Your email address is {self.email_address}.")
print(f"Your phone number is {self.phone_number}.")
print(f"Your ID card number is {self.ID_card_number}.")
def greet_user(self):
print(f"Thank you for your time, {self.first_name}!")
def increment_login_attempts(self):
self.user_attempts += 1
def reset_login_attempts(self):
self.user_attempts = 0
# Creating an instance of the User class
# Incrementing login attempts
user.increment_login_attempts()
user.increment_login_attempts()
user.increment_login_attempts()
user.increment_login_attempts()
# Printing the value of login_attempts
print("Login attempts:", user.user_attempts)
# Resetting login attempts
user.reset_login_attempts()
# Printing the value of login_attempts after reset
print("Login attempts after reset:", user.user_attempts)