Advertisement
Rnery
Oct 25th, 2023
81
0
Never
This is comment for paste Password Generator
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import choice
  2. from string import ascii_letters, digits, punctuation
  3.  
  4. def get_password_length():
  5.     return int(input("Digite o comprimento desejado da senha: "))
  6.  
  7. def generate_password(length, characters):
  8.     return ''.join(choice(characters) for _ in range(length))
  9.  
  10. def print_password(password):
  11.     print("Senha gerada:", password)
  12.  
  13. def generate_random_password():
  14.     password_length = get_password_length()
  15.     characters = ascii_letters + digits + punctuation
  16.     password = generate_password(password_length, characters)
  17.     return password
  18.  
  19. if __name__ == "__main__":
  20.     password = generate_random_password()
  21.     print_password(password)
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement