input: Write a function to encrypt a message using a key.
  assert encrypt_message("HELLO", "KEY") == "RIJVS"
  assert encrypt_message("PYTHON", "ABC") == "QZUPKP"
  assert encrypt_message("WORLD", "XYZ") == "CPSNC"
output: def encrypt_message(message, key):
      encrypted_message = []
      key_length = len(key)
      for i, char in enumerate(message):
          shift = ord(key[i % key_length]) - ord('A')
          encrypted_char = chr((ord(char) - ord('A') + shift) % 26 + ord('A'))
          encrypted_message.append(encrypted_char)
      return ''.join(encrypted_message)