input: Write a python function to encrypt and decrypt a text using a given key.
  assert encrypt("hello world", 3) == "khoor zruog"
  assert decrypt("khoor zruog", 3) == "hello world"
  assert encrypt("python", 5) == "udymts"
  assert decrypt("udymts", 5) == "python"
output: def encrypt(text, key):
      encrypted_text = ""
      for char in text:
          if char.isalpha():
              shift = 65 if char.isupper() else 97
              encrypted_text += chr((ord(char) + key - shift) % 26 + shift)
          else:
              encrypted_text += char
      return encrypted_text
  
  def decrypt(text, key):
      decrypted_text = ""
      for char in text:
          if char.isalpha():
              shift = 65 if char.isupper() else 97
              decrypted_text += chr((ord(char) - key - shift) % 26 + shift)
          else:
              decrypted_text += char
      return decrypted_text