input: Write a function to encrypt a message using a key in Python. The function should take a message and a key as inputs and return an encrypted message where each character in the message is shifted by the first character of the key. If the key is empty, the function should return the original message.
  def encrypt(message, key):
      if 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")=="Ifmmp!xpsme\"
output: def encrypt(message, key):
      if not key:
          return message
      encrypted_msg = ""
      for char in message:
          encrypted_msg += chr(ord(char) + ord(key[0]))
      return encrypted_msg