Task
Create a full-fledged text-based password generator, that will ask the user to specify:
- Total length of the password
- Whether to include uppercase letters (
A - Z) - Whether to include lowercase letters (
a - z) - Whether to include digits (
0 - 9) - Whether to include special characters (
! @ # $ % ^ & *) - Minimum number of digits
- Minimum number of special characters
- Whether to avoid ambiguous characters (e.g.
O 0 l 1 I)
Then generate and display a random password that meets all of these user requirements.
Expected Output
Enter password length: 12
Include uppercase letters? (y/n): y
Include lowercase letters? (y/n): y
Include digits? (y/n): y
Include special characters? (y/n): y
Min digits: 3
Min specials: 2
Avoid ambiguous characters? (y/n): y
Generated password: B7#kP4&t9mQ2Main Lessons
- Gathering and validating multiple user inputs
- Building flexible character pools
- Enforcing minimum-element requirements
- Random sampling and shuffling for unpredictability
- Handling edge cases and input errors
Guidelines
Feel free to implement additional features to enhance the gameplay.