Guest User

passwordgenerator

a guest
Jun 11th, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. import random
  2. import string
  3.  
  4. print("Welcome to Password Generating script!")
  5. print("Created by ------------ (Jawad Ali) ---------------- email >> jawadali565@yahoo.com")
  6. print("                                                                                 ")
  7. print("                                                                                 ")
  8. print("Please enter the number of characters you want to be your password, please enter an integer number")
  9.  
  10.  
  11.  
  12. small_letters = string.ascii_lowercase[:]
  13. capital_letters = string.ascii_uppercase[:]
  14. digits = string.digits[:]
  15. punc = string.punctuation[:]
  16.  
  17. lst = small_letters + capital_letters + str(digits) + punc
  18.  
  19.  
  20. def selection():
  21.     user = int(input("Please select a number >> "))
  22.     password_gernator(user)
  23.  
  24.  
  25. def password_gernator(n):
  26.     password = ""
  27.     length = len(lst)
  28.  
  29.     while len(password) != n:
  30.         r = random.randint(0, length - 1)
  31.         for p in lst[r]:
  32.              password += p
  33.  
  34.     print(password)
  35.  
  36. selection()
Add Comment
Please, Sign In to add comment