Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #############################
- # Bird language translator #
- # By Fillinlak3 #
- #############################
- # For Title
- import ctypes
- # Set Title
- ctypes.windll.kernel32.SetConsoleTitleW("Pasareasca - Translator")
- # Global variable
- vocale = "AEIOUaeiou"
- # Main func
- def main():
- text = str(input("Text: "))
- option = str(input("Option: "))
- if option == "1":
- text = Pasareasca_IN(text)
- elif option == "2":
- text = Pasareasca_OUT(text)
- else:
- print("Invalid option!")
- exit(0)
- print(text)
- # Code in pasareasca
- def Pasareasca_IN(text):
- alfabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- text_pasareasca = str()
- for x in range(0,len(text)):
- text_pasareasca += text[x]
- if text[x] in vocale:
- text_pasareasca += "p" + text[x].lower()
- elif x < (len(text)) - 1:
- if text[x+1] == ' ':
- text_pasareasca += "p"
- if text[len(text)-1] not in vocale and text[len(text)-1] in alfabet:
- text_pasareasca += "p"
- return text_pasareasca
- # Decode in pasareasca
- def Pasareasca_OUT(text):
- text_pasareasca = str()
- for x in range(0,len(text)):
- text_pasareasca += text[x]
- if x < len(text)-1:
- if text[x] == "p":
- if text[x+1] == ' ':
- text_pasareasca = text_pasareasca[:-1]
- elif text[x+1] in vocale:
- text_pasareasca = text_pasareasca[:-2]
- if text_pasareasca[len(text_pasareasca)-1] == "p" and text_pasareasca[len(text_pasareasca)-2] != "p":
- text_pasareasca = text_pasareasca[:-1]
- return text_pasareasca
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement