Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume that there is a digital lock that is working in two different modes: 1) Mode one is the mode that the administrator of the

image text in transcribed
image text in transcribed
Assume that there is a digital lock that is working in two different modes: 1) Mode one is the mode that the administrator of the lock defines the key password 2) Mode two is the mode that the user wants to enter a password If the entered password by the user is equal with the key password, the lock will open. For example if the key password is determined "RS98" and the user enters same password, the lock will open and a message like "Password is correct!" will be shown in the output. The purpose of this question is writing a python code that performs like this lock First the code should ask which mode the user wants to work with the code. If number "1' is entered it means that the lock will enter in mode 1 which is the administrator mode. If number "2" is entered, it means that the lock will enter user mode. Each mode is described below: Administrator mode (Mode 1): In this mode, the code will ask for admin password that is constant and defined in the code and only admin knows that. For example, admin code can be defined "A201. If the admin code is entered correctly, then program will proceed and ask admin to enter new key password. The key password is a four-character password and should contain two alphabetic letter (no matter if they are lower case or upper case) and two digits. Also, it is not important which character is a letter and which one is a digit. Below shows different possible key passwords: A21s D3f4 gg78 and etc. The code should check the suggested key password from the admin with the required criteria of the key password. When the key password is entered correctly, the program should print this message: "Key password is changed successfully. Exit admin mode" and wait for the user to enter the mode number again. If the password is not entered correctly, the code should print "The entered key password is not acceptable!" and asks for another key password. When the code exists admin mode, it should go to the default menu that asks for the mode number and shows message "Enter the mode number: and waits for the user to enter a mode. User mode (Mode 2): In this mode, the user will enter a password. This assword should be compared with the key password that the admin entered before. If the e. ered password by the user and the key password match, then the code will print: "Password is correct!" finish. Otherwise, the code should print: "Password is wrong!" and asks for another password. To answer this question, it is expected to write three different functions def Main0 This function should ask for the mode. If user enters 1, this function should call another function (called Admin0). If the user entered 2, this function should call User function In the admin function: def AdminO: The code should ask for a constant password that is always fixed and cannot be changed password: RS98 If user enters this password correctly, the program should ask for the new admin password that contain two alphabetic letter (no matter if they are lower case or upper case) and two digits (like the above examples). Otherwise, it should not accept the entered password and print: The entered key password is not acceptable!" If the entered password is following the criteria, the program should change the admin password and print: "Key password is changed successfully. Exit admin mode" If in the beginning the user enters 2, the code should go to the user function def User0: If this function, the program should ask for a password by asking like: "Enter password:". If the entered password is same as the admin password, the code should accept it: "Password is correct!" Otherwise, it should print: "Password is wrong!" and asks for another password. Enter the mode number: 1 Enter the constant password: RS98 Enter new key password: Rss21 The entered key password is not acceptable! Enter new key password: Aa31 Key password is changed successfully. Exit admin mode Enter the mode number: 2 Enter password: 13aa Password is wrongl Enter password: Aa31 Password is correct Programmed by Stew Dent. Date: Sat Feb 02 22:05:11 2019 End of processing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Infrastructure For Medical Research In Databases

Authors: Thomas Heinis ,Anastasia Ailamaki

1st Edition

1680833480, 978-1680833485

More Books

Students also viewed these Databases questions

Question

Why are benefi ts classifi ed?

Answered: 1 week ago

Question

2. Are you varying your pitch (to avoid being monotonous)?

Answered: 1 week ago

Question

3. Are you varying your speaking rate and volume?

Answered: 1 week ago