from itertools import combinations def clean_input(txt): txt = str(txt).replace(" ","").lower() return txt def extract_date(txt): dd = txt[0:2] mm = txt[2:4] yyyy = txt[4:] yy = yyyy[-2:] return dd,mm,yyyy,yy def capi(x): x2 = x.capitalize() if x==x2: return False else: return x2 def allcaps(x): x2 = x.upper() if x==x2: return False else: return x2 firstName = clean_input(input("First Name: ")) lastName = clean_input(input("Last Name: ")) middleName = clean_input(input("Middle Name: ")) nickName = clean_input(input("Nick Name: ")) birthDate = clean_input(input("Birth Date (DDMMYYYY): ")) day,month,year_long,year_short = extract_date(birthDate) birthDate = day+month+year_short long_birthDate = day+month+year_long petName = clean_input(input("Pet's Name: ")) otherKeywords = clean_input(input("Enter other keywords separated by commas: ")).split(",") data = [firstName, lastName, nickName, middleName, day, month, year_short, year_long, birthDate, long_birthDate, petName] data = data+otherKeywords for x in data: if capi(x): data = data+[capi(x)] for x in data: if allcaps(x) and allcaps(x) not in data: data = data+[allcaps(x)] comb = combinations(data, 3) passwords = [x[0]+x[1]+x[2] for x in comb] total_pass = len(passwords) fname = firstName + ".txt" out = open(fname, "w") for x in passwords: out.write(x+'\n') out.close() print(f"Total generated passwords: {total_pass}")