import random import string def generate_password(length=12): # Define the characters to use in the password characters = string.ascii_letters + string.digits + string.punctuation # Generate a random password password = ”.join(random.choice(characters) for _ in range(length)) return password # Ask the user for the desired password length password_length = int(input(“Enter the desired password length: “)) # Generate the password password = generate_password(password_length) # Print the generated password print(f”Generated Password: {password}”)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *