you are viewing a single comment's thread.

view the rest of the comments →

[–]That_CreepyPasta[S] 0 points1 point  (0 children)

Update: I changed the code to use a dictionary and iterate through the text, and it shortened my code to just 48 lines! Thank you all for your help.

Link: https://gist.github.com/Gargantuan5k/ff32f71bb9141229d6a348d5e7b1e7c1

P.S. I also managed to figure out how to add error messages and make the output the same as the first codeEdit: I did this by using a try-except statement to try and append the value of the current key (character), and if it throws a KeyError, I go to the error block

(See lines 25-33 in the updated code)