comparison peardeck.py @ 40:2aa9614cb39a

flake8
author Paper <mrpapersonic@gmail.com>
date Mon, 21 Jun 2021 15:16:15 -0400
parents 0ea9cae1339b
children
comparison
equal deleted inserted replaced
39:a93c352af05e 40:2aa9614cb39a
3 string = [] 3 string = []
4 cistring = cistring.lower() 4 cistring = cistring.lower()
5 cistring = "".join(cistring.split()) 5 cistring = "".join(cistring.split())
6 for x in range(0, len(cistring)): 6 for x in range(0, len(cistring)):
7 char = ord(cistring[x]) - 96 7 char = ord(cistring[x]) - 96
8 if char > 0 and char <= 26: string.append(int(char)-1) 8 if char > 0 and char <= 26:
9 string.append(int(char)-1)
9 return(string) 10 return(string)
10 11
12
11 # define variables 13 # define variables
12 o=["Avocados", "Bandanas", "Carrots", "Drums", "Elephants", "Flashlights", "Grapes", "Highlighters", "Incentives", "Jacks", "Kangaroos", "Lemons", "Muffins", "Ninjas", "Olives", "Pears", "Quizzes", "Raisins", "Submarines", "Turnips", "Umbrellas", "Violas", "Watermelons", "X-Rays", "Yards", "Zebras"] 14 o = ["Avocados", "Bandanas", "Carrots", "Drums", "Elephants", "Flashlights",
13 a=["Acidic", "Broke", "Confused", "Determined", "Exothermic", "Fragrant", "Green", "Hilarious", "Insincere", "Juicy", "Keen", "Lovely", "Misty", "New", "Orange", "Purple", "Quick", "Red", "Stoic", "Troubling", "Underwhelmed", "Victorious", "Warm", "Xeric", "Young", "Zesty"] 15 "Grapes", "Highlighters", "Incentives", "Jacks", "Kangaroos", "Lemons",
14 s=["Always", "Bravely", "Calmly", "Daringly", "Easily", "Fondly", "Gladly", "Honestly", "Instantly", "Joyfully", "Kindly", "Loudly", "Magically", "Neatly", "Openly", "Perfectly", "Quietly", "Rarely", "Safely", "Tenderly", "Usually", "Victoriously", "Warmly", "Xerically", "Yearly", "Zestfully"] 16 "Muffins", "Ninjas", "Olives", "Pears", "Quizzes", "Raisins",
15 c=["Award", "Bother", "Conduct", "Drive", "Evaluate", "Form", "Give", "Help", "Inspect", "Jump", "Keep", "Lift", "Memorize", "Notice", "Officiate", "Pursue", "Quiz", "Raise", "Switch", "Turn", "Underwhelm", "Vacate", "Wish", "X-Ray", "Yield", "Zip"] 17 "Submarines", "Turnips", "Umbrellas", "Violas", "Watermelons", "X-Rays",
18 "Yards", "Zebras"]
19 a = ["Acidic", "Broke", "Confused", "Determined", "Exothermic", "Fragrant",
20 "Green", "Hilarious", "Insincere", "Juicy", "Keen", "Lovely", "Misty",
21 "New", "Orange", "Purple", "Quick", "Red", "Stoic", "Troubling",
22 "Underwhelmed", "Victorious", "Warm", "Xeric", "Young", "Zesty"]
23 s = ["Always", "Bravely", "Calmly", "Daringly", "Easily", "Fondly", "Gladly",
24 "Honestly", "Instantly", "Joyfully", "Kindly", "Loudly", "Magically",
25 "Neatly", "Openly", "Perfectly", "Quietly", "Rarely", "Safely",
26 "Tenderly", "Usually", "Victoriously", "Warmly", "Xerically", "Yearly",
27 "Zestfully"]
28 c = ["Award", "Bother", "Conduct", "Drive", "Evaluate", "Form", "Give", "Help",
29 "Inspect", "Jump", "Keep", "Lift", "Memorize", "Notice", "Officiate",
30 "Pursue", "Quiz", "Raise", "Switch", "Turn", "Underwhelm", "Vacate",
31 "Wish", "X-Ray", "Yield", "Zip"]
16 32
17 # the actual start of the code 33 # the actual start of the code
18 print("what is your peardeck code?: ") 34 print("what is your peardeck code?: ")
19 i = input().lower() 35 i = input().lower()
20 ilist = A1Z26_encrypt(i) 36 ilist = A1Z26_encrypt(i)
21 try: 37 try:
22 temp = a[ilist[0]] 38 temp = a[ilist[0]]
23 except IndexError: 39 except IndexError:
24 print("ERROR: Please input letters.") 40 print("ERROR: Please input letters.")
25 except: 41 except Exception:
26 print("ERROR: Unknown error occurred!") 42 print("ERROR: Unknown error occurred!")
27 if (len(i) == 6): 43 if (len(i) == 6):
28 print(a[ilist[0]] + " ", end="") 44 print(a[ilist[0]] + " ", end="")
29 print(o[ilist[1]] + " ", end="") 45 print(o[ilist[1]] + " ", end="")
30 print(s[ilist[2]] + " ", end="") 46 print(s[ilist[2]] + " ", end="")
31 print(c[ilist[3]] + " ", end="") 47 print(c[ilist[3]] + " ", end="")
32 print(a[ilist[4]] + " ", end="") 48 print(a[ilist[4]] + " ", end="")
33 print(o[ilist[5]], end="") 49 print(o[ilist[5]], end="")
34 elif (len(i) == 5): 50 elif (len(i) == 5):
35 print(a[ilist[0]] + " ", end="") 51 print(a[ilist[0]] + " ", end="")
36 print(o[ilist[1]] + " ", end="") 52 print(o[ilist[1]] + " ", end="")
37 print(c[ilist[2]] + " ", end="") 53 print(c[ilist[2]] + " ", end="")
38 print(a[ilist[3]] + " ", end="") 54 print(a[ilist[3]] + " ", end="")
39 print(o[ilist[4]], end="") 55 print(o[ilist[4]], end="")
40 else: 56 else:
41 print("invalid input, exiting") 57 print("invalid input, exiting")
42 exit() 58 exit()