Python Strong Password Generator Tutorial

This tutorial will show you how to program a password generator with the Python coding language.

The first thing that needs to be done is to import the libraries that will be used for the generator.

import string
from random import *

Next, is the main function of the generator.

## Creating List of characters, digits and symbols 
data = string.ascii_letters +  string.digits + string.punctuation

## Randomly selecting 8 to 16 characters from the List
password =  "".join(choice(data) for x in range(randint(8,16)))

That’s it! Now all that has to be done is to print out the secure password. Here it the code in total.

import string
from random import *

## Creating List of characters, digits and symbols 
data = string.ascii_letters +  string.digits + string.punctuation

## Randomly selecting 8 to 16 characters from the List
password =  "".join(choice(data) for x in range(randint(8,16)))

print (password)

If you run the code above you should get a password that looks like this

Output :

Njc(VceJ>7U

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s