Mercurial > codedump
comparison peardeck.py @ 7:0ea9cae1339b
pythonify™ the peardeck code generator
committer: GitHub <noreply@github.com>
| author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
|---|---|
| date | Sat, 23 Jan 2021 05:18:44 -0500 |
| parents | |
| children | 2aa9614cb39a |
comparison
equal
deleted
inserted
replaced
| 6:aac9a23bd027 | 7:0ea9cae1339b |
|---|---|
| 1 # function for encrypting to a1z26 cause i'm lazy | |
| 2 def A1Z26_encrypt(cistring): | |
| 3 string = [] | |
| 4 cistring = cistring.lower() | |
| 5 cistring = "".join(cistring.split()) | |
| 6 for x in range(0, len(cistring)): | |
| 7 char = ord(cistring[x]) - 96 | |
| 8 if char > 0 and char <= 26: string.append(int(char)-1) | |
| 9 return(string) | |
| 10 | |
| 11 # 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"] | |
| 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"] | |
| 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"] | |
| 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"] | |
| 16 | |
| 17 # the actual start of the code | |
| 18 print("what is your peardeck code?: ") | |
| 19 i = input().lower() | |
| 20 ilist = A1Z26_encrypt(i) | |
| 21 try: | |
| 22 temp = a[ilist[0]] | |
| 23 except IndexError: | |
| 24 print("ERROR: Please input letters.") | |
| 25 except: | |
| 26 print("ERROR: Unknown error occurred!") | |
| 27 if (len(i) == 6): | |
| 28 print(a[ilist[0]] + " ", end="") | |
| 29 print(o[ilist[1]] + " ", end="") | |
| 30 print(s[ilist[2]] + " ", end="") | |
| 31 print(c[ilist[3]] + " ", end="") | |
| 32 print(a[ilist[4]] + " ", end="") | |
| 33 print(o[ilist[5]], end="") | |
| 34 elif (len(i) == 5): | |
| 35 print(a[ilist[0]] + " ", end="") | |
| 36 print(o[ilist[1]] + " ", end="") | |
| 37 print(c[ilist[2]] + " ", end="") | |
| 38 print(a[ilist[3]] + " ", end="") | |
| 39 print(o[ilist[4]], end="") | |
| 40 else: | |
| 41 print("invalid input, exiting") | |
| 42 exit() |
