Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago