Skip to content

Instantly share code, notes, and snippets.

@Levi-Lesches
Created September 2, 2020 05:22
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 Levi-Lesches/bf70e4a21d35a377674d5b9a8993df1b to your computer and use it in GitHub Desktop.
Save Levi-Lesches/bf70e4a21d35a377674d5b9a8993df1b to your computer and use it in GitHub Desktop.
from random import choice
import string
alphabet = string.ascii_letters
uppercaseAlphabet = alphabet.upper()
symbols = string.punctuation
numbers = string.digits
characterSets = [alphabet, symbols, numbers, uppercaseAlphabet]
LENGTH = 10
def gen_password():
result = ""
for _ in range(LENGTH):
characterSet = choice(characterSets)
character = choice(characterSet)
result += character
return result
def main():
print(gen_password())
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment