input: Write a function to encrypt a message using a key in Python. The function should append the ASCII value of the first character of the key to each character of the message, and convert the result back to a string. If the message or key is empty, the function should return the original message.
  
  def encrypt(message, key):
      if not message or not key:
          return message
      encrypted_msg = ""
      for char in message:
          encrypted_msg += chr(ord(char) + ord(key[0]))
      return encrypted_msg
  
  assert encrypt("Hello world!", "secret") == "Tqxx{,ts`q*"
  assert encrypt("", "secret") == ""
  assert encrypt("Hello world!", "") == "Hello world!"
  assert encrypt("abc", "z") == "{|}"
  assert encrypt("abc", "1") == "bc`"
output: def encrypt(message, key):
      if not message or not key:
          return message
      encrypted_msg = ""
      for char in message:
          encrypted_msg += chr(ord(char) + ord(key[0]))
      return encrypted_msg