import random 
import string
import secrets

longueur = 12
caracteres = string.ascii_letters + string.digits + string.punctuation
caracteres = string.ascii_letters + string.digits + string.punctuation


mot_de_passe = [
    secrets.choice(string.ascii_uppercase),
    secrets.choice(string.ascii_lowercase),
    secrets.choice(string.digits),
    secrets.choice(string.punctuation)
]

while len(mot_de_passe) < longueur:
    mot_de_passe.append(secert.choice(caracteres))
    
    secret.SystemRandom().shuffle(mot_de_passe)
    
    mot_de_passe = "".join(mot_de_passe)
    
print(f" Mot de passe sécurisé : {mot_de_passe}")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: