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 the encrypted message. Use a simple character substitution method where each character in the message is shifted by the ASCII value of the first character of the key.
  assert encrypt("Hello world!", "secret")=="Tqxxa iadxp!"
  assert encrypt("Python", "key")=="{ñáósx"
  assert encrypt("", "key")==""
  assert encrypt("Encryption", "password")=="Szwhctgjvz"
  assert encrypt("12345", "abc")=="12345"
output: def encrypt(message, key):
      shift = ord(key[0])
      encrypted_message = ""
      for char in message:
          if char.isalpha():
              base = ord('A') if char.isupper() else ord('a')
              encrypted_message += chr((ord(char) - base + shift) % 26 + base)
          else:
              encrypted_message += char
      return encrypted_message