Password Generator Using Python

We are going to produce a random password Generator using python.

For a Password Generator we should import string and also import import random modules

Python code for Password Generator :

  1. import string
  2. import random
  3. charc=string.ascii_uppercase+string.digit+string.ascii_lowercase+string.punctuation
  4. passw=""
  5. for x in range(random.randint(8,13)):
  6.  passw=passw+"".join(random.choice(charc))
  7. print(passw)

First we have imported string and random modules

Later a variable charc is assigned such that it should contain uppercase string,lowercase string ,digits and special symbols

Our password should contain minimum length of 8 and maximum 13.randint() selects a random number between them

we are going to iterate for a number generated by randint().

For each iteration a character is added randomly using random.choice()

Then what just print password.