Create a way to encrypt a message using a key in Python.

Input: message = “Hello world!”
key = “secret”

Output: import hashlib

def encrypt(message, key):
encrypted_msg = “”
for char in message:
encrypted_msg += chr(ord(char) + ord(key[0]))
return encrypted_msg

encrypted_msg = encrypt(message, key)
print(encrypted_msg)

Prompt: Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:
Create a way to encrypt a message using a key in Python.

### Input:
message = “Hello world!”
key = “secret”

### Output:
import hashlib

def encrypt(message, key):
encrypted_msg = “”
for char in message:
encrypted_msg += chr(ord(char) + ord(key[0]))
return encrypted_msg

encrypted_msg = encrypt(message, key)
print(encrypted_msg)