Guest User

Untitled

a guest
Feb 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import string
  2. import random
  3.  
  4.  
  5. def gen_pas():
  6. pas = []
  7. count = int(raw_input('Enter the length of your password: '))
  8. type_pas = str(raw_input('Enter the type that you prefer: "strong" or "weak". '))
  9.  
  10. if type_pas == 'strong':
  11. for i in range(count):
  12. pas.append(random.choice(string.letters + string.digits + string.punctuation))
  13. elif type_pas == 'weak':
  14. for i in range(count):
  15. pas.append(random.choice(string.ascii_lowercase + string.digits))
  16.  
  17. random.shuffle(pas)
  18. return ''.join(pas)
  19.  
  20.  
  21. print gen_pas()
Add Comment
Please, Sign In to add comment