Python Project : Random Password Generator


It is so much easy in python, to create a cool project. Here in this python tutorial, you will see how we create a python project that will generate a random password. You can show it to your friends or you can use it on your own.

It is always a good idea to learn python by creating something that you love. So I will not make you wait, and here is how you can create a python project that can create a random password for you.

password generator

Random Password Generator in Python

To create a Random Password Generator, first, open a python file and then copy and paste the following code into it. The code is well documented and I hope you will understand it.

Create a python file with the name and paste the following code in it and then run it. It will generate a random password each time.

The password will contain ASCII letters, upper and lowercase letters, and so on.

import random
import string

total = string.ascii_letters + string.digits + string.punctuation

length = 16

password = "".join(random.sample(total, length))


You can see the length of the password will be 16. you can increase or decrease the length of the password.

You may also like to read

Summary and Conclusion

In this article, you have seen how we can create a python project that generates a random password each time we run it. the password is 16 characters long. If you have any questions please let me know in the comment section.

Post a Comment

* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !