def ceasar_cipher(text, alphabet, k, code):
    """
    Will encode or decode given text based on the provided alphabet by transposition
    PARAMS:
        text (string): The text you would like to encode or decode
        alphabet (array[char] / string): List of all the available characters in order. May be one long string, or array of single characters
        k (int): The encryption key
        code (int): Whether you want to encode(0) or decode(1)
    RETURNS:
        string: Encoded ciphertext or decoded plaintext
    """

    if code == 0:

        encodingDictionairy = {}
        
        for i in range(0, len(alphabet)):
            encodingDictionairy[alphabet[i]] = alphabet[(i+k)%len(alphabet)]

        plaintext = text
        ciphertext = ""

        for plainChar in plaintext:
            ciphertext += encodingDictionairy[plainChar]

        return ciphertext

    elif code == 1:

        decodingDictionairy = {}

        for i in range(0, len(alphabet)):
            decodingDictionairy[alphabet[i]] = alphabet[(i-k)%len(alphabet)]

        ciphertext = text
        plaintext = ""

        for cipherChar in ciphertext:
            plaintext += decodingDictionairy[cipherChar]

        return plaintext