You need to play around with the provided string (s).

Move consonants forward 9 places through the alphabet.
If they pass 'z', start again at 'a'.

Move vowels back 5 places through the alphabet.
If they pass 'a', start again at 'z'.
For our Polish friends this kata does not count 'y' as a vowel.

Exceptions:

If the character is 'c' or 'o', move it back 1 place.
For 'd' move it back 3, and for 'e', move it back 4.

If a moved letter becomes 'c', 'o', 'd' or 'e', revert it back to it's original value.

Provided string will always be lower case, won't be empty and will have no special characters.

Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures
Skill types: Data structures

Starter code:
def vowel_back(st):
	

Solutions:
def vowel_back(st):
	return st.translate(str.maketrans('abcdefghijklmnopqrstuvwxyz', 'vkbaafpqistuvwnyzabtpvfghi'))


def vowel_back(s):
	return s.translate(str.maketrans('abcdeghjklmnopqrsuwxyz', 'vkbaapqstuvwnyzabpfghi'))


from string import ascii_lowercase as abc

def vowel_back(st):
	return st.translate(str.maketrans(abc, 'vkbaafpqistuvwnyzabtpvfghi'))


def vowel_back(st):
	print(st)
	changes = {'a': 'v', 'b': 'k', 'c': 'b', 'd': 'a', 'e': 'a', 'f': 'f', 'g': 'p', 'h': 'q', 'i': 'i', 'j': 's', 'k': 't', 'l': 'u', 'm': 'v', 'n': 'w', 'o': 'n', 'p': 'y', 'q': 'z', 'r': 'a', 's': 'b', 't': 't', 'u': 'p', 'v': 'v', 'w': 'f', 'x': 'g', 'y': 'h', 'z': 'i'}
	return ''.join((changes[c] for c in st))


from collections import ChainMap
from string import ascii_lowercase as al
move = ChainMap(dict(c=-1, o=-1, d=-3, e=-4), dict.fromkeys('aeiou', -5), dict.fromkeys(al, 9))
new = (al[(i + move[c]) % 26] for (i, c) in enumerate(al))
mapping = {c: c if c2 in 'code' else c2 for (c, c2) in zip(al, new)}

def vowel_back(st):
	return ''.join(map(mapping.get, st))


from string import ascii_lowercase as aLow

def shifterAndSrc(c):
	return (chr((ord(c) + SHIFT.get(c, DEFAULT) - 97) % 26 + 97), c)
SHIFT = {'a': -5, 'e': -4, 'i': -5, 'o': -1, 'u': -5, 'c': -1, 'd': -3}
(DEFAULT, REVERT) = (9, 'code')
TABLE = str.maketrans(aLow, ''.join((c if c not in REVERT else o for (c, o) in map(shifterAndSrc, aLow))))

def vowel_back(s):
	return s.translate(TABLE)


vowel_back = lambda s: ''.join((e[e[0] in 'code'] for e in [(chr(ord(x) - max(1, 'co de'.index(x)) if x in 'code' else 97 + (ord(x) - 97 - 5 if x in 'aiu' else ord(x) - 97 + 9) % 26), x) for x in s]))


def vowel_back(st):
	s = ''
	for x in st:
		res = chr(ord('a') + (ord(x) - ord('a') + ((9, -1, -3)[(x == 'c') + (x == 'd') * 2], -(5, 1, 4)[(x == 'o') + (x == 'e') * 2])[x in 'aoiue']) % 26)
		if res in 'code':
			res = x
		s += res
	return s


trans = str.maketrans('abcdeghjklmnopqrsuwxyz', 'vkbaapqstuvwnyzabpfghi')

def vowel_back(st):
	return st.translate(trans)


from string import ascii_lowercase as alpha
alpha = list(alpha)
ln = len(alpha)
vowels = 'aeiou'

def vowel_back(s):
	s = list(s)
	for (idx, char) in enumerate(s):
		index = alpha.index(char)
		if char in ('c', 'o'):
			s[idx] = alpha[index - 1]
		elif char == 'd':
			s[idx] = alpha[index - 3]
		elif char == 'e':
			s[idx] = alpha[index - 4]
		elif char in vowels:
			s[idx] = alpha[index - 5]
		else:
			index += 9
			index = index % ln
			s[idx] = alpha[index]
		if s[idx] in ('c', 'o', 'd', 'e'):
			s[idx] = char
	return ''.join(s)