Random Python Password Generator

This script generates a secure, random password using a mix of letters, digits, and punctuation.

Click to view script…
import random
import string

def generate_password(length=12):
    characters = string.ascii_letters + string.digits + string.punctuation
    password = ''.join(random.choice(characters) for _ in range(length))
    return password

print("Your new password is:", generate_password())