Rövarspråket Language Encoder and Decoder
Your program has an unused import: import string. You can use tools like flake8, pylint to catch such errors.
I ran your code at pep8online and it pointed out 3 errors:




E302:3:1:expected 2 blank lines, found 1
E302:8:1:expected 2 blank lines, found 1
E302:15:1:expected 2 blank lines, found 1


Basically this means there should be two empty lines after imports, class definition, function definition. Check PEP 8 for more details.


VOWELS variable is well suited to be a global variable. Plus you can convert it to a string to make it easier to read: VOWELS = 'AEIOUYÅÄÖ'.
str.upper() is redundant as str objects already have upper methods, hence letter.upper() in VOWELS is all you need. Similarly str.lower() call can be changed to character.lower().
Note that the in check already returns boolean, hence unless you are trying to be extra explicit you can reduce those 3 lines to return letter.upper() in VOWELS.
You can assign word[i] to a variable inside the while loop to make it easier to read: character = word[i]. Plus i can renamed to better variable like index.
For case insensitive comparison you probably want to read up this thread: How do I do a case insensitive string comparison in Python?

Lastly add annotations to your function definitions so that it becomes more clear what type of arguments a function is expecting and what it returns. Function annotation can also be used to static analysis tools like mypy to catch errors beforehand.




VOWELS = 'AEIOUYÅÄÖ'


def main() -&gt; None:
    word = input('Enter Phrase : ')
    final_word = rövarspråket(word)
    print(final_word)


def is_vowel(letter: str) -&gt; bool:
    return letter.upper() in VOWELS


def rövarspråket(word: str) -&gt; str:
    new_word = []

    for character in word:
        new_word.append(character)
        if character.isalpha() and not is_vowel(character):
            new_word.append('o' + character.lower())

    return ''.join(new_word)


def decode_rövarspråket(word: str) -&gt; str:
    original_word = []
    i = 0
    while i &lt;= (len(word) - 1):
        character = word[i]
        original_word.append(character)
        if character.isalpha() and not is_vowel(character):
            i += 3
        else:
            i += 1
    return ''.join(original_word)