37Password Generator

Coming up with a password that meets specific requirements is something your computer can do. And it will give you practice using random number generators in conjunction with a list of known values.

Create a program that generates a secure password. Prompt the user for the minimum length, the number of special characters, and the number of numbers. Then generate a password for the user using those inputs.

Example Output

 
What's the minimum length? 8
 
How many special characters? 2
 
How many numbers? 2
 
Your password is
 
aurn2$1s#

Constraints

  • Use lists to store the characters you’ll use to generate the passwords.

  • Add some randomness to the password generation.

Challenges

  • Randomly convert vowels to numbers, such as 3 for E and ...

Get Exercises for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.