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 :
- import string
- import random
- charc=string.ascii_uppercase+string.digit+string.ascii_lowercase+string.punctuation
- passw=""
- for x in range(random.randint(8,13)):
- passw=passw+"".join(random.choice(charc))
- 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.
0 Comments
Post a Comment