PW Akshay

Generation

code to explanationMon, 28 Nov 2022

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)

This code will import the random module and the string module. Then it will make constants to use in the code. Then it will ask you how long you want the password to be. Then it will make a variable that stores the password. Then it will make a loop that makes the length of the password as long as you want it to be. Then it will print the password.

Questions about programming?Chat with your personal AI assistant