Last active
August 29, 2015 14:15
-
-
Save Pavelovich/c7e1894d58d73fecd9ec to your computer and use it in GitHub Desktop.
Neckbeard translator
This file contains 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
#!/usr/bin/python | |
# Debug strings, comment out entry prompt to test the program | |
string = "Hello m'lady, please do not friendzone. I am a really nice guy." | |
string = "M'Hello m'lady, m'please m'do m'not m'friendzone. M'I m'am m'a m'really m'nice m'guy." | |
def toNeckbeard(string): | |
string = "M'"+string | |
string = string.replace(" "," m'") | |
string = string.replace("m'm'","m'") | |
string = string.replace("m' ","") | |
string = string.replace(". m",". M") | |
string = string.replace("! m","! M") | |
string = string.replace("? m","? M") | |
string = string.replace(". m",". M") | |
string = string.replace("! m","! M") | |
string = string.replace("? m","? M") | |
return string | |
def fromNeckbeard(string): | |
string = string.replace("m'","") | |
string = string.replace("M'","") | |
return string | |
def chkexit(func_in): | |
if func_in.lower().strip() == "exit": | |
exit() | |
print ''' | |
Neckbeard translator | |
Translate sentences to and from neckbeard | |
Version 1.3.1 | |
Copyright (c) 2015 maelstr0m, MIT license | |
''' | |
input = "" | |
return_input = "" | |
while return_input != "2": | |
string = raw_input("Enter text to translate > ") | |
chkexit(string) | |
input = "" | |
while input != "1" and input != "2": | |
print "Select option:\n [1] Translate to neckbeard\n [2] Translate from neckbeard" | |
input = raw_input(" > ").strip() | |
chkexit(input) | |
if input == "1": | |
string = toNeckbeard(string) | |
elif input == "2": | |
string = fromNeckbeard(string) | |
else: | |
string = toNeckbeard(string) | |
print string | |
return_input = "" | |
while return_input != "1" and return_input != "2": | |
print "Would you like to translate another sentence?\n [1] Yes\n [2] No" | |
return_input = raw_input(" > ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment