Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import capwords
- _CYPHER = {
- "a" : "ka",
- "b" : "tu",
- "c" : "mi",
- "d" : "te",
- "e" : "ku",
- "f" : "lu",
- "g" : "ji",
- "h" : "ri",
- "i" : "ki",
- "j" : "zu",
- "k" : "me",
- "l" : "ta",
- "m" : "rin",
- "n" : "to",
- "o" : "mo",
- "p" : "no",
- "q" : "ke",
- "r" : "shi",
- "s" : "ari",
- "t" : "chi",
- "u" : "do",
- "v" : "ru",
- "w" : "mei",
- "x" : "na",
- "y" : "fu",
- "z" : "zi"
- }
- def replacement(cypher, string):
- """Given a cypher, performs a substitution on string and returns the result."""
- string_to_return = ""
- for char in string.lower():
- try:
- string_to_return = string_to_return + cypher[char]
- except:
- string_to_return = string_to_return + " "
- return string_to_return
- while True:
- r = raw_input("String?")
- print capwords(replacement(_CYPHER, r))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement