import random from string import * constants = ascii_letters + digits + punctuation print(constants) password_length = int(input("What's the length of the password? ")) password = "" for i in range(password_length): password += random.choice(constants) print(password)
The above script generates a random password. It takes the length from the user and generates the length password using the ascii values.