Created
June 23, 2015 13:49
-
-
Save jonathanpike/bc07d1423cd2d50e54b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from http://www.practicepython.org/exercise/2014/05/28/16-password-generator.html | |
import random | |
import string | |
def genpass(): | |
lower_letters = list(string.ascii_lowercase) | |
upper_letters = list(string.ascii_uppercase) | |
symbols = list(string.punctuation) | |
num = list(range(1,9)) | |
characters = lower_letters + upper_letters + symbols + num | |
password = [] | |
length = int(raw_input("How long do you want your password to be? ")) | |
count = 0 | |
while count < length: | |
password.append(characters[random.randrange(0, 92)]) | |
count += 1 | |
print ''.join(str(x) for x in password) | |
genpass() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment