input: Write a function to encrypt a message using a key in Python. The function should take two parameters: the message to be encrypted and the key used for encryption. For each character in the message, the function should add the ASCII value of the first character of the key to the ASCII value of the character in the message and append the result to the encrypted message. If the key is shorter than the message, it should be reused from the beginning. If the key or message is empty, the function should return an empty string. Finally, return the encrypted message.
  
  assert encrypt("Hello world!", "secret")=="ŠŠŠŠŠŠŠŠŠŠŠ"
  assert encrypt("Hi there", "key")=="õùùªªïª"
  assert encrypt("Python", "code")=="ĄńŶťŻã"
  assert encrypt("Encrypt", "")==""
  assert encrypt("", "key")==""
output: def encrypt(message, key):
      if not message or not key:
          return ""
      encrypted_message = ""
      key_length = len(key)
      for i, char in enumerate(message):
          encrypted_char = chr(ord(char) + ord(key[i % key_length]))
          encrypted_message += encrypted_char
      return encrypted_message