1.12 Lab: Check Login Credentials (classes) Complete the Login class implementation. For the class method check_credenti

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

1.12 Lab: Check Login Credentials (classes) Complete the Login class implementation. For the class method check_credenti

Post by answerhappygod »

1.12 Lab: Check Login Credentials (classes)
Complete the Login class
implementation. For the class method check_credentials(), you will
need to
accept two arguments - login and passwd. Do not forget about the
self argument.
This class method will set two local variables simlogin =
"Test" and simpass = "test1234".
These variables will simulate the correct login and password for
the credential check process.
The method will receive the login and password from the user and
check it with Test and test1234.
If the user sent the correct credentials output:
Successful login!
If the user sent the correct login name but the wrong password
output:
Login name is correct, incorrect password!
If the user sent an incorrect login name but the correct
password output:
Login name is incorrect, password accepted!
If the user sent both incorrect login name and password
output:
Unsuccessful login attempt!
The class method will return a boolean success variable as True
if the login was successful.
Using if __name__ == "__main__" to control the flow of
your code, add a loop that will stop the
process if the
user attempts more than 5 login attempts.
Ex: If the input is:
And this is their first incorrect attempt. The output is:
Unsuccessful login attempt!
Try again - you have 4 attempts left!
If the input is:
The output is:
1 12 Lab Check Login Credentials Classes Complete The Login Class Implementation For The Class Method Check Credenti 1
1 12 Lab Check Login Credentials Classes Complete The Login Class Implementation For The Class Method Check Credenti 1 (93.13 KiB) Viewed 84 times
LAB ACTIVITY 1.12.1: Lab: Check Login Credentials (classes) main.py def __init__(self): self.login_name 'none' self.login_password = 'none' 6 # TODO: Define class method - check_credentials(self, user_login, user_passwd) 8 9 if name__ "__main__": Login() 5 #variable used for login attempts input() = input() 1 class Login:| 2 HN3 +56 4 10 11 12 13 14 15 login = timeout login password 6/10 Load default template...
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply