import secrets alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*" password_length = int(input("Enter the desired password length: ")) password = "" for i in range(password_length): password += secrets.choice(alphabet)
print("Generated password:", password)