Question

Create a python script to manage a user list that can be modified and saved to...

Create a python script to manage a user list that can be modified and saved to a text file.

Input text file consisting of pairs of usernames and passwords, separated by a colon (:) without any spaces

User choice: (‘n’-new user account, ‘e’-edit existing user account, ‘d’- delete existing user account, ‘l’- list user accounts, ‘q’-quit)

List of user accounts, error messages when appropriate

Output text file consisting of pairs of username and passwords, separated by a colon (:) without any spaces

The program maintains a list of user accounts and passwords supplied by a system administrator.

Any inputted username should be stripped of any non-alphanumeric characters (special characters such as ! @ # $ % ^ & * ( ) _ + ; : ’ ”) using: username = re.sub(r'\W+','',username) [You need to import the library "re"] and should be converted to lowercase: username = username.lower()

Any inputted password should be stripped of the apostrophe character ' using: password = password.replace('\'', '')

Each option should be implemented as a separate function within a Package that will be imported, so that its functions can be called. Valid options will be stored in a list to test for invalid options:
function = [‘n’, ‘e’, ‘d’, ‘l’, ‘q’]

The usernames and passwords will be loaded from an input file and stored in a dictionary (Python’s version of a hash). The dictionary will be passed as a parameter from the Python script file to the appropriate function in the module file and updated according to the function. The script file should import the functions from the module file to call the appropriate function.

Initially, the program prompts for an input text file to read from. If the file does not exist, it should be created. The program should then loop until the user chooses to quit (selects status as ‘q’). If the user enters an illegal status, the program will prompt again for the status input. Upon quitting, the program prompts the user to save the list to an output file with the same name as the original input text file.

Sample output:

Enter file to open: myfile.txt
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: n
Enter username: einstein
Enter password: e=mc^2
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: n
Enter username: newton
Enter password: f=ma
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: n
Enter username: pythagoras
Enter password: a^2+b^2=c^2
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: n
Enter username: einstein
Username already exists!
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: e
Enter username to modify: fibonacci
Username does not exist!
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: e
Enter username to edit: newton
Enter current password: f=m*a
Incorrect password!
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: e
Enter username to edit: newton
Enter current password: f=ma
Enter new password: force=mass*accelaration
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: d
Enter username to delete: pythagoras
User removed
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: l
einstein:e=mc^2
newton:force=mass*accelaration
User accounts
-------------
n = New user account
e = Edit existing user account
d = Delete existing user account
l = List user accounts
q = Quit
Enter choice: q
Save contents? (y/n): y
% more myfile.txt
einstein:e=mc^2
newton:force=mass*acceleration
0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Create a python script to manage a user list that can be modified and saved to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • need help in Java Now we’ll continue our project by writing a Facebook class that contains an ArrayList of Facebook user...

    need help in Java Now we’ll continue our project by writing a Facebook class that contains an ArrayList of Facebook user objects. The Facebook class should have methods to list all of the users (i.e. print out their usernames), add a user,delete a user, and get the password hint for a user You will also need to create a driver program. The driver should create an instance of the Facebook class and display a menu containing five options: list users...

  • in java Complete Program that simulates a login procedure. The program reads a list of names,...

    in java Complete Program that simulates a login procedure. The program reads a list of names, email addresses and passwords from a file p3.txt. Store the information in parallel array lists names, emails and passwords. Your program will prompt the user for their email address. If the email is not in the system, prompt the user to try again. Provide the option to quit. If the email is found in the system, prompt the user to enter their password. After...

  • ATM MACHINE

    Kindly help me In this assignment you will create a RMI based system that allows a user to do the following: 1) Create a bank account by supplying a user id and password. 2) Login using their id and password. 3) Quit the program. Main Manu of ATM service window *Separate remote methods will be created for all of these functionalities. ->To create account see output below Hi! Welcome to  ATM Machine! Please select an option from the menu below: l -> Loginc -> Create New Account q -> Quit > c...

  • Assignment Write a menu-driven C++ program to manage a class roster of student names that can...

    Assignment Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students...

  • Write a menu-driven C++ program to manage a class roster of student names that can grow...

    Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students Q...

  • Language: C++ PLEASE INCLUDE SCREENSHOT OF OUTPUT In this assignment, you will consider the problem of organizing a collection of computer user-ids and passwords. Each time a user logs in to the syste...

    Language: C++ PLEASE INCLUDE SCREENSHOT OF OUTPUT In this assignment, you will consider the problem of organizing a collection of computer user-ids and passwords. Each time a user logs in to the system by entering his or her user-id and a secret password, the system must check the validity of this user-id and password to verify that this is a legitimate user. Because this validation must be done many times each day, it is necessary to structure this information in...

  • Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user...

    Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user login system. Your code should do the following: 3, create-user_name() #use this function to create the user name 1.Create your user database called "UD.txt", this should be in CSV format 4, write-file() #user this function to save the user name and password into "UD.txt" Deliverables: Sample: the data you saved...

  • working on a Python program, making a shopping list giving the user several options:to view the...

    working on a Python program, making a shopping list giving the user several options:to view the list, to add an item or to delete and an option to exit the program. It's not working at all. please help. File Edit Format Run Options Window Help class shopping: det init (self, final list): self.final_list=1 det add_item(self, item): self.final list.append(item] print("The added temi " + str(item) + ".") det delete item(self, item): gelf.final list.remove(item) print (the deleted item is "+ste (item) +".")...

  • DESCRIPTION Create a C++ program to manage phone contacts. The program will allow the user to...

    DESCRIPTION Create a C++ program to manage phone contacts. The program will allow the user to add new phone contacts, display a list of all contacts, search for a specific contact by name, delete a specific contact. The program should provide the user with a console or command line choice menu about possible actions that they can perform. The choices should be the following: 1. Display list of all contacts. 2. Add a new contact. 3. Search for a contact...

  • I am creating a program that will allow users to sign in with a username and...

    I am creating a program that will allow users to sign in with a username and password. Their information is saved in a text file. The information in the text file is saved as such: Username Password I have created a method that will take the text file and convert into an array list. Once the username and password is found, it will be removed from the arraylist and will give the user an opportunity to sign in with a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT