input: Write a function to encode a string using Caesar Cipher with a given key.
  assert encode_caesar_cipher('Hello World', 2) == 'Jgnnq Yqtnf'
  assert encode_caesar_cipher('abc', 3) == 'def'
  assert encode_caesar_cipher('XYZ', 4) == 'BCD'
output: def encode_caesar_cipher(text, key):
      result = []
      for char in text:
          if char.isalpha():
              shift = key % 26
              if char.islower():
                  base = ord('a')
                  new_char = chr((ord(char) - base + shift) % 26 + base)
              else:
                  base = ord('A')
                  new_char = chr((ord(char) - base + shift) % 26 + base)
              result.append(new_char)
          else:
              result.append(char)
      return ''.join(result)