Objective
Create a Python program that generates a random password with the random and string modules.
Instructions
- Import the
randomandstringmodules. - Read the length
nof the password. - Build the set of allowed characters by joining
string.ascii_letters(letters) andstring.digits(digits). - Generate the password by choosing
nrandom characters withrandom.choice. - Since it is random, do not show it. Show
Length: non the first line andAlphanumeric: Von the second, whereVis the result ofisalnum()on the password.
8
Length: 8
Alphanumeric: True
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise