# Introduction 

Digital Cypher assigns to each letter of the alphabet unique number. For example:

```
 a  b  c  d  e  f  g  h  i  j  k  l  m
 1  2  3  4  5  6  7  8  9 10 11 12 13
 n  o  p  q  r  s  t  u  v  w  x  y  z
14 15 16 17 18 19 20 21 22 23 24 25 26
```

Instead of letters in encrypted word we write the corresponding number, eg. The word scout:

```
 s  c  o  u  t
19  3 15 21 20
```
Then we add to each obtained digit consecutive digits from the key. For example. In case of key equal to `1939` :

```
   s  c  o  u  t
  19  3 15 21 20
 + 1  9  3  9  1
 ---------------
  20 12 18 30 21
  
   m  a  s  t  e  r  p  i  e  c  e
  13  1 19 20  5 18 16  9  5  3  5
+  1  9  3  9  1  9  3  9  1  9  3
  --------------------------------
  14 10 22 29  6 27 19 18  6  12 8
```

# Task

Write a function that accepts `str` string and `key` number and returns an array of integers representing encoded `str`.

# Input / Output

The `str` input string consists of lowercase characters only.
The `key` input number is a positive integer.

# Example

```
Encode("scout",1939);  ==>  [ 20, 12, 18, 30, 21]
Encode("masterpiece",1939);  ==>  [ 14, 10, 22, 29, 6, 27, 19, 18, 6, 12, 8]
```

# Digital cypher series
- [Digital cypher vol 1](https://www.codewars.com/kata/592e830e043b99888600002d)
- [Digital cypher vol 2](https://www.codewars.com/kata/592edfda5be407b9640000b2)
- [Digital cypher vol 3 - missing key](https://www.codewars.com/kata/5930d8a4b8c2d9e11500002a)

Difficulty: EASY
Tags: Fundamentals

Starter code:
def encode(message, key):
	

Solutions:
from itertools import cycle

def encode(message, key):
	return [ord(a) - 96 + int(b) for (a, b) in zip(message, cycle(str(key)))]


def encode(message, key):
	output = []
	i = 0
	key = [int(d) for d in str(key)]
	for char in message:
		n = ord(char) + key[i]
		output.append(n - 96)
		i = (i + 1) % len(key)
	return output


def encode(message, key):
	return [ord(char) - 96 + int(str(key)[i % len(str(key))]) for (i, char) in enumerate(message)]


import itertools
import string

def encode(message, key):
	return [string.ascii_lowercase.index(c) + k + 1 for (c, k) in zip(message, itertools.cycle((int(c) for c in str(key))))]


from itertools import cycle

def encode(message, key):
	return [ord(ch) - 96 + int(code) for (ch, code) in zip(message, cycle(str(key)))]


encode = lambda s, n: [ord(c) + int(d) - 96 for (c, d) in zip(s, str(n) * len(s))]


from itertools import cycle
abc = 'abcdefghijklmnopqrstuvwxyz'

def encode(message, key):
	key = cycle((int(x) for x in str(key)))
	return [abc.index(m) + 1 + k for (m, k) in zip(message, key)]


def encode(message, key):
	a = []
	key = str(key)
	for i in range(len(message)):
		print(i)
		a.append(ord(message[i]) - 96 + int(key[i % len(key)]))
	return a


def encode(message, key):
	abc_dict = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
	num_list = []
	key_list = str(key)
	x = 0
	for i in message:
		num_list.append(abc_dict[i] + int(key_list[x]))
		x += 1
		if x >= len(key_list):
			x = 0
	return num_list


from itertools import cycle
from typing import List

def encode(message: str, key: int) -> List[int]:
	return [ord(m) - 96 + k for (m, k) in zip(message, cycle(list(map(int, str(key)))))]


def encode(message, key):
	base_dict = {}
	alpha = 'abcdefghijklmnopqrstuvwxyz'
	for i in range(26):
		base_dict[alpha[i]] = i + 1
	key_extended = []
	count = 0
	for i in range(len(message)):
		try:
			key_extended.append(int(str(key)[count]))
		except IndexError:
			count = 0
			key_extended.append(int(str(key)[count]))
		count += 1
	encrypt = []
	for letter in message:
		encrypt.append(base_dict[letter])
	code = []
	for i in range(len(encrypt)):
		code.append(encrypt[i] + key_extended[i])
	return code


from itertools import cycle

def encode(message, key):
	key = cycle(map(int, str(key)))
	return [ord(c) - 96 + next(key) for c in message]


encode = lambda m, k: [ord(a) - 96 + int(b) for (a, b) in zip(m, str(k) * 30)]


def encode(message, key):
	key_digs = [int(dig) for dig in str(key)]
	result = [ord(ch) - 96 + key_digs[i % len(key_digs)] for (i, ch) in enumerate(message)]
	return result


import string as st
letras = st.ascii_lowercase

def encode(message, key):
	codif_1 = [letras.index(l) + 1 for l in message]
	key_list = [int(l) for l in str(key)]
	n = int(len(message) / len(key_list))
	r = len(message) % len(key_list)
	mascara = key_list * n + key_list[:r + 1]
	return [codif_1[i] + mascara[i] for i in range(len(codif_1))]


def encode(message, key):
	key = str(key)
	return [ord(message[i]) - 96 + int(key[i % len(key)]) for i in range(0, len(message))]


encode = lambda m, k: (lambda k: [ord(l) - 96 + int(k[i % len(k)]) for (i, l) in enumerate(m)])(str(k))


import string
import numpy as np
alpha = list(string.ascii_lowercase)
values = list(range(1, 27))
dictionary = dict(zip(alpha, values))

def encode(word, old_key):
	key = [int(x) for x in str(old_key)]
	letter_values = []
	for letter in word:
		letter_values.append(dictionary[letter])
	count = 0
	new_list = []
	while count < len(word):
		for number in key:
			if count >= len(word):
				break
			else:
				count += 1
				new_list.append(number)
	key_np = np.array(new_list)
	letter_np = np.array(letter_values)
	final = (key_np + letter_np).tolist()
	return final


def encode(message, key):
	cypher = {chr(ord('a') + i): i + 1 for i in range(26)}
	return [cypher[letter] + int(str(key)[i % len(str(key))]) for (i, letter) in enumerate(message)]


from itertools import cycle

def encode(message, key):
	a = cycle(str(key))
	return [ord(x) - 96 + int(next(a)) for x in message]


from decimal import Decimal
from itertools import cycle

def encode(message, key):
	key_digits = cycle(Decimal(key).as_tuple().digits)
	return [ord(c.lower()) - ord('a') + next(key_digits) + 1 for c in message]


from itertools import cycle

def encode(message, key):
	c = cycle(str(key))
	return [ord(i) + int(ord(next(c))) - 144 for i in message]


def dist_from_prev_a(x):
	return ord(x) - ord('a') + 1

def encode(message, key):
	x = [dist_from_prev_a(i) for i in message]
	y = list(str(key) * len(message))[:len(message)]
	return [x[i] + int(y[i]) for i in range(len(x))]


def encode(message, key):
	ret = []
	d = dict()
	[d.update({chr(i): i - 96}) for i in range(97, 123)]
	for i in range(len(message)):
		ret.append(d[message[i]] + int(str(key)[i % len(str(key))]))
	return ret


def encode(message, key):
	mess = list(map(lambda x: ord(x) - 96, message))
	str_key = [int(i) for i in str(key)]
	for i in range(0, len(mess)):
		mess[i] = mess[i] + str_key[i % len(str_key)]
	return mess


from itertools import cycle
alphabet_numbers = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}

def encode(message, key):
	key = str(key)
	key_cycle = cycle(map(int, key))
	lst = []
	for letter in message:
		if letter in alphabet_numbers:
			lst.append(alphabet_numbers.get(letter) + next(key_cycle))
	return lst


def encode(message, key):
	z = [int(i) for i in str(key)]
	x = 0
	sol = []
	for i in message:
		if x == len(z):
			x = 0
		sol.append(ord(i) - 96 + z[x])
		x += 1
	return sol


def encode(message, key):
	abc = 'a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z'.split('  ')
	cypher = []
	key = str(key)
	for (i, letter) in enumerate(list(message)):
		letterToDigit = abc.index(letter) + 1
		addedKeyIndex = i % len(key)
		addedKeyValue = key[addedKeyIndex]
		cypher.append(letterToDigit + int(addedKeyValue))
	return cypher


def encode(message, key):
	key = list(str(key))
	alpha = list('0abcdefghijklmnopqrstuvwxyz')
	message = list(message)
	code = [alpha.index(message[i]) for i in range(len(message)) if message[i] in alpha]
	i = -1
	for j in range(len(code)):
		if i == len(key) - 1:
			i = -1
		i += 1
		code[j] = code[j] + int(key[i])
	return code


def encode(message, key):
	al = 'abcdefghijklmnopqrstuvwxyz'
	key = str(key)
	if len(message) > len(key):
		key = key * int(len(message) / len(key) + 1)
	out = []
	for i in list(message):
		out.append(al.index(i) + 1)
	for i in range(len(out)):
		out[i] = out[i] + int(key[i])
	return out


def encode(message, key):
	dicti = {}
	code = []
	ans = []
	letters = list(message)
	alphabet = list('abcdefghijklmnopqrstuvwxyz')
	for i in range(len(alphabet)):
		dict_ = {alphabet[i]: i + 1}
		dicti.update(dict_)
	for letter in letters:
		for (k, v) in dicti.items():
			if k == letter:
				code.append(v)
	key_list = list(str(key))
	a = len(message) // len(key_list)
	if len(message) > len(key_list):
		key_list = key_list * (a + 1)
	for j in range(len(code)):
		if j < len(message):
			new_code = code[j] + int(key_list[j])
			ans.append(new_code)
		elif j == len(message):
			break
	return ans


def encode(message, key):
	key = [int(k) for k in str(key)]
	l = len(key)
	return [ord(c) - 96 + key[i % l] for (i, c) in enumerate(message)]


def encode(message, key):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	alphabet = list(alphabet)
	letters_numbers = {}
	for i in range(len(alphabet)):
		dict_ = {alphabet[i]: i + 1}
		letters_numbers.update(dict_)
	message_numbers = []
	for j in message:
		number = letters_numbers[j]
		message_numbers.append(number)
	key = str(key)
	key = list(key)
	final_message_encoded = []
	for k in range(len(message)):
		key.append(key[k])
	for l in range(len(message_numbers)):
		message_encoded = message_numbers[l] + int(key[l])
		final_message_encoded.append(message_encoded)
	return final_message_encoded


def encode(word, key):
	vo = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
	kk = list(map(int, str(key)))
	kk = kk * int(len(word) / len(kk) + 1)
	k = list(word)
	arr = []
	for i in k:
		arr.append(vo.get(i))
	for j in range(len(arr)):
		arr[j] += kk[j]
	return arr


def encode(s, k):
	eng = '_abcdefghijklmnopqrstuvwxyz'
	b = list(map(int, list(str(k))))
	(q, r) = divmod(len(s), len(str(k)))
	return list(map(lambda x, y: x + y, b * q + b[:r], list([eng.index(_) for _ in s])))


def encode(m, key):
	k = list(map(int, list(str(key))))
	kL = len(k)
	m = list(m)
	for i in range(len(m)):
		m[i] = ord(m[i]) - 96 + k[i % kL]
	return m


def encode(message, key):
	letters = {chr(97 + x): x + 1 for x in range(28)}
	return [letters[l] + int(add) for (l, add) in zip(message, list(str(key)) * len(message))]


from itertools import cycle

def encode(message, key):
	letters = []
	fullkey = [int(x) for x in str(key)]
	for character in message:
		number = ord(character) - 96
		letters.append(number)
	outcome = [x + y for (x, y) in zip(letters, cycle(fullkey))]
	return outcome


def encode(message, key):
	import string
	alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	code = []
	for i in range(len(message)):
		code += [alphabet.index(message[i]) + 1]
	keystr = str(key)
	for i in range(len(code)):
		code[i] += int(keystr[i % len(keystr)])
	return code


def encode(m, k):
	d = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
	count = 0
	l = []
	p = []
	n = []
	st = str(k)
	lst = list(st)
	for x in range(len(m)):
		num = d.get(m[x])
		l.append(num)
	while count < len(l):
		for y in range(len(lst)):
			if count < len(l):
				p.append(int(lst[y]))
				count = count + 1
			else:
				break
	for z in range(len(l)):
		calc = l[z] + p[z]
		n.append(calc)
	return n


encode = lambda m, k: [ord(d) - ord('a') + 1 + int(str(k)[i % len(str(k))]) for (i, d) in enumerate(m)]


from collections import deque

def encode(message, key):
	out = []
	key = deque(map(int, str(key)))
	for c in message:
		out.append(ord(c) - 96 + key[0])
		key.rotate(-1)
	return out


def encode(message: str, key):
	return [ord(x) - 96 + int(str(key)[i % len(str(key))]) for (i, x) in enumerate(message.lower())]


import string
map = {ch: i + 1 for (i, ch) in enumerate(string.ascii_lowercase)}

def encode(message, key):
	key = str(key)
	res = []
	for (i, ch) in enumerate(message):
		res.append(map[ch] + int(key[i % len(key)]))
	return res


def encode(message, key):
	num = []
	key = str(key)
	length = len(key)
	for i in range(0, len(message)):
		num.append(ord(message[i]) - 96 + (ord(key[i % length]) - 48))
	print(num)
	return num


def encode(message, key):
	message = message.lower()
	key = list(str(key))
	message = list(message)
	for i in range(len(message)):
		message[i] = ord(message[i]) - 96 + int(key[i % len(key)])
	return message


def encode(message, key):
	indexKey = 0
	l = [ord(m) - 96 for m in message]
	for i in range(len(message)):
		l[i] += int(str(key)[indexKey])
		indexKey = (indexKey + 1) % len(str(key))
	return l


def encode(message, key):
	return [i + int(l) for (i, l) in zip([' abcdefghijklmnopqrstuvwxyz'.index(i) for i in message], str(key) * (len(message) // len(str(key))) + str(key)[:len(message) % len(str(key))])]


def encode(message, key):
	arr = []
	for i in range(len(message)):
		encr = ord(message[i]) - 96
		if i > len(str(key)) - 1:
			k = i - len(str(key)) * (i // len(str(key)))
		else:
			k = i
		arr.append(encr + int(str(key)[k]))
	return arr


def encode(msg, k):
	return [ord(m) - 96 + int(str(k)[i % len(str(k))]) for (i, m) in enumerate(msg)]


def encode(message, key):
	key_tracker = 0
	ciphertext = []
	key = [int(k) for k in str(key)]
	letters = [ord(a) - 96 for a in message]
	for i in range(len(letters)):
		letters[i] += key[key_tracker]
		key_tracker += 1
		if key_tracker == len(key):
			key_tracker = 0
	return letters


from string import ascii_lowercase as alpha

def encode(message, key):
	first = [alpha.index(x) + 1 for x in message]
	(n, k) = (len(message), str(key))
	return [first[i] + int(k[i % len(k)]) for i in range(n)]


from itertools import cycle

def encode(message, key):
	key = list(map(int, str(key)))
	return [ord(c) - 96 + k for (c, k) in zip(message, cycle(key))]


def encode(message, key):
	key = list(map(int, str(key)))
	return [ord(c) - 96 + key[i % len(key)] for (i, c) in enumerate(message)]


def encode(message, key):
	message = [ord(x) - 96 for x in message]
	key = str(key)
	key_list = list(key)
	x = list(key)
	while len(key_list) != len(message):
		if not x:
			x = list(key)
		key_list.append(x.pop(0))
	return [message[i] + int(x) for (i, x) in enumerate(key_list)]


from itertools import chain, repeat
alpha = 'abcdefghijklmnopqrstuvwxyz'

def encode(message, key):
	message_l = [alpha.index(c) + 1 for c in message]
	key_l = [i for i in chain.from_iterable(repeat([int(num) for num in str(key)], 100))]
	return [message_l[i] + key_l[i] for i in range(len(message_l))]


def encode(message, key):
	return [ord(j) - 96 + int((str(key) * (len(message) // len(str(key)) + 1))[i]) for (i, j) in enumerate(message)]


def encode(message, key):
	ans = []
	key = list(str(key))
	counter = 0
	for i in message:
		if counter == len(key):
			counter = 0
		ans.append(ord(i) - 96 + int(key[counter]))
		counter += 1
	return ans


def encode(message, key):
	return [ord(message[a]) - 96 + int(str(key)[a % len(str(key))]) for a in range(len(message))]


def encode(message, key):
	msgnumber = [ord(m) - 96 for m in message]
	key = (str(key) * int(len(message) / len(str(key)) + 1))[:len(message)]
	key = [int(k) for k in key]
	return [m + k for (m, k) in zip(msgnumber, key)]


def encode(message, key):
	alpha = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
	count = 0
	value = 0
	res = []
	n = len(message)
	key_index = list((i for i in str(key)))
	m_index = list((j for j in message))
	m = len(str(key)) - 1
	while count < n:
		res.append(alpha[m_index[count]] + int(key_index[value]))
		if value == m:
			value = 0
		else:
			value += 1
		count += 1
	print(res)
	return res


def encode(message, key):
	pre_output = []
	for letter in message:
		pre_output.append(ord(letter) - 96)
	output = []
	key = str(key)
	i = 0
	for number in pre_output:
		output.append(number + int(key[i]))
		if i == len(key) - 1:
			i = 0
		else:
			i += 1
	return output


def encode(m, k):
	k = map(int, (str(k) * (len(m) // len(str(k)) + 1))[:len(m)])
	return list(map(sum, zip([ord(x) - 96 for x in m], k)))


def encode(message, key):
	key = list(str(key) * (len(message) // len(str(key)) + 1)) if len(str(key)) < len(message) else list(str(key))
	encode_list = []
	key_index = 0
	for i in list(message):
		encode_list.append(ord(i) - 96 + int(key[key_index]))
		key_index += 1
	return encode_list


from itertools import cycle

def encode(message, key):
	a = []
	for (m, c) in zip(message, cycle(str(key))):
		d = ord(m) - 96 + int(c)
		a.append(d)
	return a


def encode(message, key):
	import string
	alphabet = enumerate(string.ascii_lowercase, 1)
	dic_letters = {k: v for (v, k) in alphabet}
	numbers = [dic_letters[letter] for letter in message]
	lst_key = len(message) * [int(x) for x in str(key)]
	lst_zip = list(zip(numbers, lst_key))
	return list((sum(group) for group in lst_zip))


def encode(message, key):
	k = [int(x) for x in str(key)]
	return [ord(message[x]) - 96 + k[x % len(k)] for x in range(len(message))]


def encode(message, key):
	a = []
	j = 0
	for i in message:
		a.append(ord(i) - 96 + int(str(key)[j]))
		j += 1
		if j == len(str(key)):
			j = 0
	return a


def encode(message, key):
	key_list = list(str(key))
	encoded_list = []
	k = 0
	for letter in message:
		letter_digit = ord(letter) - 96
		letter_digit_encoded = letter_digit + int(key_list[k % len(key_list)])
		encoded_list.append(letter_digit_encoded)
		k += 1
	return encoded_list


def encode(message, key):
	res = []
	db = {chr(i): i - 96 for i in range(97, 123)}
	zippand1 = [db[i] for i in message]
	zippand2 = list(map(int, str(key))) * len(str(message))
	return [i + j for (i, j) in zip(zippand1, zippand2[:len(message)])]


def encode(message, key):
	arr = []
	for i in range(len(message)):
		arr.append(ord(message[i]) - 96 + int(str(key)[i % len(str(key))]))
	return arr


def encode(message, key):
	coded_message = [ord(char) - 96 for char in message]
	return [digit + int(str(key)[index % len(str(key))]) for (index, digit) in enumerate(coded_message)]


def encode(message, key):
	val = [ord(i) - 96 for i in message]
	check = str(key)
	index = 0
	for (idx, i) in enumerate(val):
		if idx % len(check) == 0:
			index = 0
		val[idx] += int(check[index])
		index += 1
	return val


def encode(message, key):
	L1 = 'abcdefghijklmnopqrstuvwxyz'
	L2 = []
	number = 0
	L3 = []
	for i in message:
		L2.append(L1.index(i) + 1 + int(str(key)[number % len(str(key))]))
		number += 1
	return L2


def encode(message, key):
	strKey = str(key)
	return [ord(letter) - 96 + int(strKey[index % len(strKey)]) for (index, letter) in enumerate(message)]


import string
from itertools import cycle

def encode(message, key):
	alphabet = dict(zip(string.ascii_lowercase, (ord(i) - 96 for i in string.ascii_lowercase)))
	key = cycle([int(i) for i in str(key)])
	res = []
	for i in message:
		encoding = int(alphabet.get(i)) + next(key)
		res.append(encoding)
	return res


def encode(m, key):
	array_key = []
	list_int_str_key = [int(x) for x in str(key)]
	len_str_key = len(list_int_str_key)
	ords_list = [ord(x) - 96 for x in m]
	len_ords_list = len(ords_list)
	i = 0
	while len(array_key) < len_ords_list:
		array_key.append(list_int_str_key[i])
		i += 1
		if i >= len_str_key:
			i = 0
	return [a + b for (a, b) in zip(array_key, ords_list)]


from string import ascii_lowercase as abc
from itertools import cycle

def encode(message, key):
	return [abc.index(m) + k + 1 for (m, k) in zip(message, cycle(map(int, str(key))))]


from string import ascii_lowercase as abc
from itertools import cycle

def encode(message, key):
	return [int(x) + abc.index(ch) + 1 for (x, ch) in list(zip(cycle(str(key)), message))]


def encode(message, key):
	key = str(key) * len(message)
	return ['abcdefghijklmnopqrstuvwxyz'.index(m) + int(key[i]) + 1 for (i, m) in enumerate(message)]


from itertools import cycle

def encode(message, key):
	return [v + int(v1) for (v, v1) in zip([ord(c) - 96 for c in message], cycle(str(key)))]


def encode(message, key):
	return [ord(c) - ord('`') + int(str(key)[i % len(str(key))]) for (i, c) in enumerate(message)]


def encode(message, key):
	fuck = [ord(x) - 96 for x in message]
	cunt = [int(x) for x in str(key)]
	for (index, cum) in enumerate(fuck):
		fuck[index] += cunt[index % len(str(key))]
	return fuck


from string import ascii_lowercase as alpha

def encode(message, key):
	key = (len(message) // len(str(key)) + 1) * str(key)
	return [alpha.index(c) + int(k) + 1 for (c, k) in zip(message, key)]


from string import ascii_lowercase as letters

def encode(message, key):
	return [letters.index(m) + int(k) + 1 for (m, k) in zip(message, f'{key}' * len(message))]