Question
I'm new to learning Python 3.6, and have been trying some practice problems. I'm having some trouble with this one, from the instructions given, and
I'm new to learning Python 3.6, and have been trying some practice problems. I'm having some trouble with this one, from the instructions given, and would really appreciate some help, especially with the code layout, indentation... any additional information, like as explaination of each step in the code would also be really helpful and appreciated.
__________________________________________________________________________________________
Write a program for a user accounts management system, using Python dictionary structure
The program should fulfill the following requirements:
All the username and password should be kept in a dictionary. In the dictionary, please use username as key and password as the value for each item.
First the program tells the user enter 1 to register, enter 2 to sign in, enter 3 to quit
After the user enter 1, the program ask the user to input username and password, the username can not be the same as any existing ones. The username must contain at least 4 characters. If the entered username does not satisfy these two conditions, ask the user for a new username
During the registration, once the user entered a valid username, ask the user to create a password. The password has to contain at least one letter and one digit. The length of the password should be more than 4 characters. If the password provided by the user does not satisfy the requirements, ask the user to create a new password.
After registration, tell the user Congratulations! You have setup a new account and direct the user back to the starting point.
If the user enters 2, tell the user either Wrong password or Wrong username until the user enters a correct username and password combination
The program counts the number of attempts made by the user in entering password/username. If the user tried more than 4 times for either password or username without success, indicate to the user "Exceeded username attempts, please contact the system administrator" or "Exceeded password attempts, please contact the system administrator" Then exit the program (you can use exit() statement). The counts for username and password attempts should be kept separately.
Display Welcome back! after user entered the correct user name and password.
.....................................................................................................
There was also a .Py file provided as the "Password Check Function," to use in the program, for checking password validity. This is what it contained:
def check_password (psswd):
containAlpha = any(c.isalpha() for c in psswd) #Checks if a password contains any letter, or any digit and has length bigger than 4
containNum = any(c.isdigit() for c in psswd) #Checks if the password contains at least one letter
return (containAlpha and containNum and len(psswd)>4) #Checks if the password contains at least one digit
print(check_password("abcdef"))
print(check_password("123456"))
print(check_password("ab12"))
print(check_password("abc123"))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started