Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alphabet = list("abcdefghijklmnopqrstuvwxyz")
- rand_chars = "-@#$%^&*()_+-={}|[];:<`>/~"
- troll_alphabet = sorted(rand_chars)
- def trollify(text):
- '''english -> troll language'''
- print("\nTROLL::::\033[91m")
- print(''.join([troll_alphabet[alphabet.index(ch.lower())] if ch != " " and ch in alphabet and ch not in rand_chars else ch for ch in text.lower() if ch not in rand_chars]) + "\033[0m")
- def englishify(text):
- '''troll language -> english'''
- print("\nENGLISH::::\033[91m")
- print( ''.join([alphabet[troll_alphabet.index(ch)] if ch in troll_alphabet else ch for ch in text]) + "\033[0m")
- to_do = input("enter 1 to translate english -> troll \nenter 2 to translate troll -> english: ")
- if to_do != "1" and to_do != "2":
- print("\nyou did not enter 1 or 2")
- exit()
- text = input("\nenter text to translate:\n")
- if to_do == "1":
- trollify(text)
- if to_do == "2":
- englishify(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement