Question: 2) Complete the following: a) Write a function, generate_password(n) where n is the length of the password. The function should generate a password with n/2
2) Complete the following: a) Write a function, generate_password(n) where n is the length of the password. The function should generate a password with n/2 letters and n/2 (+1 if odd) digits. The letters should be randomly selected from a -z, and you should randomly capitalize the letters before adding to the password. b) Write a script that generates passwords using the lengths input from the user. passwords until the user inputs-1 to quit. The input length of a password cannot be less than 5 and your program should validate the input and prompt again for invalid input. Sample Run: Enter password length (-1 to quit): 5 Your password is: aq373 You should generate Enter password length (-1 to quit): 4 Password minimum length is!5 Enter password length Your password is: qSm354 Enter password length (-1 to quit): 9 Your password is: jkerdo996 Enter password length (-1 to quit): -1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
