Created
June 6, 2017 17:58
-
-
Save codeboy101/6cb506b096d0cc15e25f6ba617a67aa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import ascii_lowercase | |
code = { | |
'a':'b', 'b':'c', 'c':'d', 'd':'e', 'e':'f', 'f':'g', 'g': 'h', 'h': 'i', 'i': 'j', 'j': 'k', 'k' : 'l', 'l' : 'm', | |
'm' :'n', 'n' :'o', 'o': 'p', 'p':'q', 'q' : 'r', 'r': 's', 's': 't', 't' : 'u', 'u':'v', 'v': 'w', 'w':'x', | |
'x' : 'y', 'y' : 'z', 'z' : 'a', ' ': ' ' | |
} | |
allowedchars = ascii_lowercase + ' ' | |
def changer(a,b): | |
code[a] = b | |
return code | |
def taker(): | |
put = input("Enter Text ") | |
put = put.lower() | |
for i in put: | |
if i in allowedchars: | |
print(code[i], end='') | |
elif put == '!!!': | |
return | |
else: | |
raise Exception("404") | |
print() | |
def changing(): | |
fromletter = input ("Enter Base Letter ") | |
toletter = input ("Enter to Change") | |
code = changer(fromletter, toletter) | |
def show_code(): | |
for k, v in code.items(): | |
print(k, v) | |
run = True | |
while run: | |
gamestart = input("What to do, press 1 to 2") | |
if gamestart == '1': | |
taker() | |
elif gamestart == '2': | |
changing() | |
else: | |
run = False | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment