Question: python For this exercise we'll mix some input with some string processing, toss in a bit of randomness, and produce a program that generates faux
python
For this exercise we'll mix some input with some string processing, toss in a bit of randomness, and produce a program that generates faux user names and suggested passwords for users, based on their inputs. Implement the following in a program called passwords.py, Your program should prompt the user for three pieces of information: Their first name, last name, and favorite word. You'll then use those pieces of information to help generate something that could be used as a unique user name, as well as three suggested passwords, each constructed using different rules. A sample interaction is shown below: Welcome to the username and password generator! Please enter your first name: Ron Please enter your last name: Thomas Please enter your favorite word: Literature Thanks Ron, your user name is rthomas*81 Here are three suggested passwords for you to consider: Password 1: ron53thm@$ Password 2: rNESIE Password 3: ThomaLitro 1. Write code that uses input to read the user's first name, last name, and favorite word, prompting them each time so that they know what to enter. (Your prompts don't have to look exactly like the ones above though feel free to be creative.) 2. The username generated by your program should consist of the first letter from the user's first name, followed by the first seven letters from their last name, and a random integer between 0 and 99. The letters in the username should all be lower case, and you should add + (asterisk) characters as necessary if the last name is shorter than seven characters. (Hint: Add some extra * 's (asterisks) to the last name before you select the seven-character piece, whether you need them or not.) For full credit, your solution must build a single string containing all of these characters and then print it, rather than just printing each piece separately. You should also be polite and personalize the response by including the user's first name, as shown above. 3. The first password is the concatenation of the user's first and last names, in lower case, with a random integer in the range 0 - 99 between them. Some of the characters in the resulting string are then replaced by similar-looking digits and punctuation characters. For full credit, you should perform the following replacements, though you can feel free to add some more of your own: All a characters should be replaced by @, o by 0,1 by 1, and s by $. 4. The second password is an "acronym", consisting of the first and last character from the user's first name, the first and last character of their last name, and the first and last letter of their favorite word. In each case, the first letter of the pair should be lower case and the second should be upper case. 5. The third password takes a random-length portion of the first name, combined with random-length portions of the favorite word and last name in any order). In each case, those random-length pieces should start at the beginning of the string, and the code should be written such that it's possible to get the entire string if the largest possible random number is produced. At least one character from each part (first name, last name, and favorite word) should appear in the password. 6. For full credit, your code should contain comments. There should be a comment at the top of the program containing your name and a sentence or two explaining what it's about, and one above the main function outlining what's being computed and how. Add comments above each major section of your code too - one describing how the username-creation code works, and one for each of the password approaches
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
