Blog
Random Password Generator
- Harshit
- August 1, 2020
- 7:14 pm
- No Comments
A code to include a random password generator for your interesting projects!
Welcome to the code! Making a security project for your school or college? python’s the best way to make it simple and efficient. Use this code to generate a random password and improve the security of your project.
In this code, we will be generating a random password of letters, numbers, and symbols of the required length to create a unique code that can be used for security purposes.
Note: Loved the post? You too can publish your article on “Python for fun” which will be loved by millions. Contribute an article!
import string
from random import *
characters = string.ascii_letters + string.punctuation + string.digits
len_characters = int(input("How long should the password be?"))
for x in range(len_characters):
password = "".join(choice(characters))
print (password, end="")
#For length to be random, we can use the below code:
import string
from random import *
characters = string.ascii_letters + string.punctuation + string.digits
for x in range(randint(8, 16)):
password = "".join(choice(characters))
print (password, end="")
Share on facebook
Share on whatsapp
Share on pinterest
0
0
votes
Rating
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments