You have been presented with a cipher, your goal is to re-create the cipher with little information. Use the examples provided to see if you can find a solution to how this cipher is made. You will be given no hints, only the handful of phrases that have already been deciphered for you. 

Your only hint: Spaces are left alone, they are not altered in any way. Anytime there is a space, it should remain untouched and in place.

I hope you enjoy, but this one should be genuinely infuriating.

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def cipher(phrase:
	

Solutions:
def cipher(p):
	return ''.join((chr((ord(j) + i % 3 + (i - 1) // 3 - 97) % 26 + 97) if j != ' ' and i != 0 else j for (i, j) in enumerate(p)))


from itertools import count
BASE = ord('a')

def deltas():
	for i in count(-1):
		yield max(i, 0)
		yield (i + 2)
		yield (i + 3)

def cipher(phrase):
	return ''.join((c if c.isspace() else chr(BASE + (ord(c) - BASE + delta) % 26) for (c, delta) in zip(phrase, deltas())))


from string import ascii_lowercase as A

def cipher(phrase: str):
	a = A * 2 + ' ' * 26
	seq = lambda n: n % 3 + n // 3 + (n % 3 > 0) - (n > 0)
	cip = lambda i: a[a.index(phrase[i]) + seq(i)]
	return ''.join(map(cip, range(len(phrase))))


cifer_sequence = [0, 1, 2, 0, 2, 3]

def cipher(phrase: str):
	crypt = ''
	for (i, simbol) in enumerate(phrase):
		if i < len(cifer_sequence):
			cifer_sequence.append(cifer_sequence[-3] + 1)
		if simbol == ' ':
			crypt += ' '
		else:
			crypt += chr((ord(simbol) - ord('a') + cifer_sequence[i]) % 26 + ord('a'))
	return crypt


def shift(s=1):
	yield 0
	while 1:
		yield s
		s += 1
		yield s
		yield (s - 2)

def cipher(s):
	return ''.join((c if c == ' ' else chr((x + ord(c) - 97) % 26 + 97) for (c, x) in zip(s, shift())))


def cipher(phrase: str):
	t = [0, 2, 3]
	string = ''
	x = -1
	for i in phrase:
		x += 1
		if ord(i) != ord(' '):
			c = ord(i) - 97
			if x == 0:
				string += chr(c + 97)
			elif x == 1:
				string += chr((c + 1) % 26 + 97)
			elif x == 2:
				string += chr((c + 2) % 26 + 97)
			else:
				string += chr((c + t[x % 3] + int(x / 3) - 1) % 26 + 97)
		else:
			string += ' '
	print(string)
	return string


def cipher(phrase: str):
	mass = ['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', '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']
	j = 0
	cip = []
	num = []
	x = 0
	y = 1
	z = 2
	for i in range(0, len(phrase), 3):
		num.append(x)
		if y >= 2:
			x += 1
		num.append(y)
		y += 1
		num.append(z)
		z += 1
	for i in range(0, len(phrase)):
		for j in range(0, len(mass)):
			if phrase[i] == mass[j]:
				j = j + num[i]
				cip.append(mass[j])
				break
			elif phrase[i] == ' ':
				cip.append(' ')
				break
	return ''.join(cip)


def cipher(str):
	key = [0, 1, 2, 0, 2, 3, 1, 3, 4, 2, 4, 5, 3, 5, 6, 4, 6, 7, 5, 7, 8, 6, 8, 9, 7, 9, 10, 8, 10, 11, 9, 11, 12, 10, 12, 13, 11, 13, 14, 12, 14, 15, 13, 15, 16, 14, 16, 17, 15, 17, 18, 16, 18, 19, 17, 19, 20, 18, 20, 21, 19, 21, 22, 20, 22, 23, 21, 23, 24, 22, 24, 25, 23, 25, 26]
	result = ''
	alphabet = 'abcdefghijklmnopqrstuvwxyz' * 2
	for i in range(len(str)):
		if str[i] == ' ':
			result += ' '
			continue
		alpha_index = alphabet.find(str[i])
		result += alphabet[alpha_index + key[i]]
	return result


def cipher(phrase: str):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	res = [phrase[0]]
	for (i, char) in enumerate(phrase[1:]):
		if char != ' ':
			res.append(alphabet[(ord(char) - 97 + i // 3 + (i + 1) % 3) % 26])
		else:
			res.append(' ')
	return ''.join(res)


def cipher(phrase: str):
	return ''.join((chr(ord('a') + (ord(c) - ord('a') + i % 3 + (i - 1) // 3) % 26) if i > 0 and c != ' ' else c for (i, c) in enumerate(phrase)))