crzcas

password

Jan 13th, 2021 (edited)
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. import random
  2. import string
  3.  
  4. LETTERS = string.ascii_letters
  5. NUMBERS = string.digits  
  6. PUNCTUATION = string.punctuation    
  7.  
  8. def random_pswd(m):
  9.     chars = LETTERS + NUMBERS + PUNCTUATION
  10.     pswd = ""
  11.     for j in range(m):
  12.         pswd += random.choice(chars)
  13.     return pswd
  14.  
  15. m = int(input("Enter password length: "))
  16.  
  17. print(random_pswd(m))
  18.  
Add Comment
Please, Sign In to add comment