My Channel

Can't Create an Unique and Strong Password? Well this is the right tool that you need, For free Of Course!

 IF YOU CAN'T COME UP WITH A STRONG PASSWORD, THEN TRY THIS PYTHON PROGRAM...





It's been a long time since I have posted anything, since I was into my YouTube channel and other works you know. But Since I care about my readers a lot, I came back to give them a Christmas treat with this nice PASSWORD GENERATOR!

Anyway,



Anyway, Let's get into the main TOPIC!

So, let me tell you how the logic for this password generator works...

So we use 3 modules to make this program run - Random, Time, String.

We basically choose a random character or digit or punctuation characters or symbols over 10 times because we want the length of the password to be 10.

THE CODE:


1.Here we import the modules required for the program

import random, time
import string


2. We use the string module to store all the digits, characters and symbols, all of them in a single character variable

characters = string.ascii_letters + string.digits + string.punctuation


3.Next, we create a function called Password()

def password():


4. We initialize a variable known as Password and leave it empty

password = ""

5. We start a Loop to choose a random character from the character variable given above and we add it to the string password each time. We have the range to be 10 since the length of the password required is 10

for i in range(10):
password += random.choice(characters)

6. "WAIT! You used the random and string module, but where is the time module"?. Well, here it is...I added a loading statement just for fun to make it look like the computers really working hard to create a strong password for you

print("Getting things ready...")
time.sleep(2)
print("Mixing up Characters...")
time.sleep(2)

7. Next I used the print statement to print the Password Generated

print("Password Generated: ",password)

8. Lastly, we have to call the function that we created above on which the entire program runs

password()

THE ENTIRE CODE:

import random, time
import string

characters = string.ascii_letters + string.digits + string.punctuation

def password():
password = ""
for i in range(10):
password += random.choice(characters)

print("Getting things ready...")
time.sleep(2)
print("Mixing up Characters...")
time.sleep(2)
print("Password Generated: ",password)

password()

THE OUTPUT:

Getting things ready...
Mixing up Characters...
Password Generated: lIEC&;T3U4


Yay! You made it till the end🎉🥳🎊!

Just be sure to Follow this Blog.

Subscribe to my YouTube channel for more of these contents...

I will also be sharing details on my new Discord Bot that I am developing in Python. If you want to watch that - MICK THE GUY.

Post a Comment

0 Comments