Home / Projects / Password Generator
Day 7 · Day 7: Intermediate Python

Password Generator

Build a secure password generator that creates random passwords based on user-specified length and character sets, using list comprehensions, the random module, and string constants.

Requirements

1. Ask the user for the desired password length.
2. Ask the user which character types to include: lowercase, uppercase, digits, symbols.
3. Use Python's string module constants (string.ascii_lowercase, string.ascii_uppercase, string.digits, string.punctuation).
4. Combine selected character sets into a single pool using a list comprehension or string concatenation.
5. Use random.choice() in a loop or comprehension to generate the password.
6. Validate that at least one character type is selected and length is reasonable (e.g., >= 4).
7. Allow generating multiple passwords without restarting the program.
50 XP on completion Back to Day 7

Your Code

Output
Click "Run" to execute your code...

Log in to mark this project complete and earn XP.