Skip to content

Instantly share code, notes, and snippets.

@harendra21
Created May 19, 2022 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harendra21/2218e741ee7965a0d82ace0f8b75a34e to your computer and use it in GitHub Desktop.
Save harendra21/2218e741ee7965a0d82ace0f8b75a34e to your computer and use it in GitHub Desktop.
from random import choice
from string import printable
def random_password(length):
"""
Provides a random password of the given length.
:param int length: The length of the password to generate.
"""
return "".join([choice(printable) for x in range(int(length))])
if __name__ == "__main__":
amount = int(input("How many passwords: "))
number = int(input("Length of password? "))
for i in range(1, amount + 1):
print(f" Password: {i} - {repr(random_password(number))} ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment