Question

Using Python

INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1 import re 2 def main): #import re module #main function user-nane-get-user-name() password-get password) #calling #calling42 43 #create-user-name #creating username create_user_name(f-name,1-name): user_namezf_name[:2]+1-name [:3] return user_name

import re #import re module
def main(): #main function
   user_name=get_user_name() #calling get_user_name function
   password=get_password() #calling get_password function
  
   f=open("ud.txt",'a') #opening file ud.txt in append mode
   string=user_name+","+password #creating string with username and password
   f.write(string) #writing string to file
  
   print("Hi ",f_name,", Your User name is ",user_name,".",sep='') #printing statement
  


def get_user_name(): #calling get_user_name function
   print("Enter First name")
  
   global f_name #declaring f_name as global variable
   f_name=input() #taking f_name
  
   print("Enter Last name")
   l_name=input() #taking l_name
  
   user_name=create_user_name(f_name,l_name) #calling create_user_name function
   return user_name #returning user_name
  
  
def get_password(): #get_password function
   print("Enter password,password should more than 8 characters,with at least one digit,one symbol,and one uppercase")
   passwrd=input() #taking password
  
   flag=0 #declaring flag
   while(flag==0): #loop iterates until flag is 1
       regex=re.compile('[\W\d[A-Z]]') #regex string to validate password
      
       if (regex.search(passwrd)==None and len(passwrd)>=8): #checking requirements
           flag=1 #flag=1
       else: #if password is not valid
           print("Did not meet password requirements,re-enter password")
           passwrd=input() #taking password again
           flag=0
   return passwrd #returning password
          
          
def create_user_name(f_name,l_name): #create_user_name
   user_name=f_name[:2]+l_name[:3] #creating username by slicing
   return user_name.lower()

  
main()

1 USERNAME, PASSWORD 2 miker, !MLpass123

jack@jack-TravelMate-P243-H:~$ Enter First name Mike python3 ud.ру Enter Last name Kerry Enter password,password should more

Add a comment
Know the answer?
Add Answer to:
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...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • FOR JAVA: Summary: Write a program to assess password stringency. The solution should be named Password.java....

    FOR JAVA: Summary: Write a program to assess password stringency. The solution should be named Password.java. Include these steps: Write an application that provides the criteria for a strong password, and accepts a user's password from an input dialog box. If the entered password is less than six characters, more than 10 characters, or does not contain at least one uppercase letter and one digit, prompt the user to enter again. When the user's entry meets all the password requirements,...

  • Please make this Python code execute properly. User needs to create a password with at least...

    Please make this Python code execute properly. User needs to create a password with at least one digit, one uppercase, one lowercase, one symbol (see code), and the password has to be atleast 8 characters long. try1me is the example I used, but I couldn't get the program to execute properly. PLEASE INDENT PROPERLY. def policy(password): digit = 0 upper = 0 lower = 0 symbol = 0 length = 0 for i in range(0, len(password)): if password[i].isdigit(): # checks...

  • Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username an...

    Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username and password management. You accomplished the tasks with Dictionary or List. Here, use class to design your own data structure to accomplish a similar task. The UD.txt datafile: FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave, Dcon,dcf987, BHYW4fw Dell, Grant,dgr803,Sb83d2d Mike, Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt, your program can search for users’ password....

  • How do I format this into C++? This the prompt: Design a class named Password that...

    How do I format this into C++? This the prompt: Design a class named Password that stores a password in a c-string and has member functions to test if the password complies with certain requirements as follows: The password should be between 6 and 20 characters long. The password should contain at least one uppercase and at least one lowercase letter. The password should have at least one digit. The password should have at least one punctuation character. Define a...

  • In C Write a function that asks for the user's first, middle, and last names. The...

    In C Write a function that asks for the user's first, middle, and last names. The names will be entered by the user on a single line and will be stored in three different C-strings. The program should then store, in a fourth array, the name arranged in the following manner: the last name followed by a comma and a space, followed by the first name and a space, followed by the middle name. For example, if the user entered...

  • Introduction to Java programming You will create a secure password. Ask a user to enter first...

    Introduction to Java programming You will create a secure password. Ask a user to enter first name and last name. (Allow for mixed case) Create a random integer from 10-99. Create the password string that consists of the upper case letter of the last letter of his/her first name, the random number, and the first three letters of his/her last name in lower case. Example someone with the name Rob Lee might have a password that looks like B56lee. Your...

  • Write a program that asks the user to enter a password, and then checks it for...

    Write a program that asks the user to enter a password, and then checks it for a few different requirements before approving it as secure and repeating the final password to the user. The program must re-prompt the user until they provide a password that satisfies all of the conditions. It must also tell the user each of the conditions they failed, and how to fix it. If there is more than one thing wrong (e.g., no lowercase, and longer...

  • Lab 3: Databased Admin Tool Python Objective: Develop an admin tool for username and password management. You will need...

    Lab 3: Databased Admin Tool Python Objective: Develop an admin tool for username and password management. You will need to use the best data structure to store the data you read from UD.txt for efficient processing. You can accomplish these tasks with Dictionary or List. The data file (UD.txt) : FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave,Dcon,dcf987, BHYW4fw Dell,Grant,dgr803,Sb83d2d Mike,Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt Give the following options: A: Search by...

  • 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...

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