Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # These imports are important.
- import random
- import string
- import sys
- import os
- # We will use string module as it will make our work easy.
- os.system("title Password Generator.")
- # This function will be used to create some random and strong passwords.
- def GeneratePass(PassLen):
- # We used the Characters from the Greatful ASCHII Table,
- # this made our work easier.
- # Break it into a list.
- Chars = list(string.ascii_letters + string.digits + string.punctuation)
- # We got it but it's not that secure,
- # let's make it secure.
- # This will shuffle all the items in the list and place then randomly.
- random.shuffle(Chars)
- # Let's print our password.
- # Now are password should be random and strong.
- Password = "".join(Chars[:PassLen])
- print(f"Your password is: {Password}")
- input("Continue.")
- # Create a if statement asking for the length of your password.
- # If the input is not a number then throw error.
- PasswordLength = input("Enter your Password Length: ")
- if PasswordLength.isdigit() == False:
- print("It's not a valid number.")
- else:
- GeneratePass(int(PasswordLength))
- sys.exit() # Exit the program.
- # AND IT'S DONE!!!
- # YOU HAVE CREATED YOUR VERY OWN PASSWORD GENERATOR.
- # THIS PASSWORD GENERATOR IS NOT VERY GOOD BUT IT DOES A DECENT JOB.
- # HAVE FUN!
- # THANKS FOR WATCHING, AND PLEASE LEAVE A LIKE, AND SUBSCRIBE IF YOU ARE NEW...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement