Created
January 31, 2017 01:01
-
-
Save Ra1d7/5305cf47ba725260c4fbc8c18bda2958 to your computer and use it in GitHub Desktop.
Generates a password based on user's opinion
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
import random | |
decid = input('how string do you want your password to be?(weak/medium/strong): ') | |
leng = int(input('how long do you want your password to be?: ')) | |
weak = 'a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z'.split(':') | |
medium = '0:1:2:3:4:5:6:7:8:9'.split(':') | |
strong = '!:@:#:$:%:^:&:*:_:-:=:.'.split(':') | |
password = '' | |
if decid.lower() == 'weak': | |
while len(password) < leng: | |
password += weak[random.randint(0,25)] | |
elif decid.lower() == 'medium': | |
while len(password) < leng: | |
password += weak[random.randint(0,25)] | |
password += medium[random.randint(0,9)] | |
elif decid.lower() == 'strong': | |
while len(password) < leng: | |
password += weak[random.randint(0,25)] | |
password += medium[random.randint(0,9)] | |
password += strong[random.randint(0,11)] | |
print(password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment