A simple and lightweight Python script that generates secure, random passwords using letters, digits, and punctuation characters.
Users can define the exact password length, and the script instantly outputs a strong, unpredictable password.
- Generates completely random passwords
- Uses letters, digits, and symbols
- User-defined password length
- No external dependencies
- Works on all major platforms
- Ideal for security testing and daily use
This script is useful for:
- Creating strong passwords for online accounts
- Cybersecurity learning and practice
- Developers needing quick password generation
- Automation and scripting tools
- Secure authentication workflows
import string
from random import choice
characters = string.ascii_letters + string.punctuation + string.digits
password_length = int(input("How many characters should your password be? "))
password = "".join(choice(characters) for _ in range(password_length))
print(password)