DEV Community

Cover image for Password Generator
Israel-Lopes
Israel-Lopes

Posted on • Updated on

Password Generator

Dependencies

  • itertools
  • python3
import string
import itertools

# Define the list of characters that will be used in the password
chars = string.ascii_letters + string.digits + string.punctuation

#Set password length
password_length = 8

# Generates all character combinations with the specified size
combinations = itertools.product(chars, repeat=password_length)

# Prints each generated combination
for combination in combinations:
  password = "".join(combination)
  print(password)
Enter fullscreen mode Exit fullscreen mode

Texto alternativo da imagem)

Top comments (0)