Skip to content
Snippets Groups Projects
Commit 13c81dfb authored by mm4857's avatar mm4857
Browse files

Upload New File

parent b9213a08
No related branches found
No related tags found
No related merge requests found
import random
questions = ["What is your favorite vacation spot and why?","Have you ever traveled out of country? Why or why not?","What is your favorite animal and why?","When and where did you meet your best friend?","What was your first car and why did you choose that one?"]
stopWords = ["there", "however", "therefore", "before", "whenever", "although","because"]
validQuestion = False
validInput = False
important = True
print("Select a question from the following list to help generate your password:")
print("1.", questions[0])
print("2.", questions[1])
print("3.", questions[2])
print("4.", questions[3])
print("5.", questions[4])
while validInput == False:
selection = input("")
try:
x = int(selection)
selection = int(selection)
if ((selection <= 5) and (selection >= 1)):
validInput = True
else:
print("Please type the number corresponding to one of the questions.")
except:
print("Please type the number corresponding to one of the questions.")
myquestion = questions[selection-1]
while validQuestion == False:
keywords = []
rmPunct = []
answer = input("Please answer the question '"+myquestion+"'\n")
answer = answer.lower()
letters = list(answer)
for letter in letters:
if (letter == ",") or (letter == ".") or (letter == "?") or (letter == "!") or (letter == "'") or (letter == "-") or (letter == '"'):
continue
else:
rmPunct.append(letter)
prunedText = ''.join(rmPunct)
tokens = prunedText.split()
for word in tokens:
if len(word) >= 5:
important = True
for stopword in stopWords:
if word == stopword:
important = False
if important == True:
keywords.append(word)
if len(keywords) > 0:
validQuestion = True
else:
print("Please answer using more descriptive language.")
editKeys = []
for keyword in keywords:
passwordletters = list(keyword)
editWord = []
for character in passwordletters:
rand = random.randint(0,10)
if rand > 5:
character = character.upper()
if rand > 8:
if character == 'A':
character = '4'
if character == 'E':
character = '3'
if character == 'S':
character = '5'
if character == 'Z':
character = '2'
if character == 'T':
character = '7'
if character == 'I':
character = '1'
editWord.append(character)
editKeyword = (''.join(editWord)+str(random.randint(0,100)))
editKeys.append(editKeyword)
print('Here are some suggested passwords:')
for password in editKeys:
print(password)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment