input: Write a function to encrypt a message using a key in Python. The function should take a string message and a string key as input, and return an encrypted string where each character in the message is shifted by the ASCII value of the first character of the key. If either the message or the key is empty, the function should return an empty string.
  assert encrypt("Hello world!", "secret")=="Tqxx{,x}x!"
  assert encrypt("Hello world!", "key")=="Khoor#zruog$"
  assert encrypt("", "secret")==""
  assert encrypt("Hello world!", "")==""
  assert encrypt("", "")==""
output: def encrypt(message, key):
      if not message or not key:
          return ""
      shift = ord(key[0])
      encrypted = ''.join(chr(ord(char) + shift) for char in message)
      return encrypted