A very passive-aggressive co-worker of yours was just fired. While he was gathering his things, he quickly inserted a bug into your system which renamed everything to what looks like jibberish. He left two notes on his desk, one reads: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" while the other reads: "Uif usjdl up uijt lbub jt tjnqmf kvtu sfqmbdf fwfsz mfuufs xjui uif mfuufs uibu dpnft cfgpsf ju".


Rather than spending hours trying to find the bug itself, you decide to try and decode it. 


If the input is not a string, your function must return "Input is not a string". Your function must be able to handle capital and lower case letters. You will not need to worry about punctuation.

Difficulty: EASY
Starter code: def one_down(txt):
	

Solutions:
lower = 'abcdefghijklmnopqrstuvwxyz'

def one_down(txt):
	if not isinstance(txt, str):
		return 'Input is not a string'
	shifted = lower[-1] + lower[:-1]
	table = str.maketrans(lower + lower.upper(), shifted + shifted.upper())
	return txt.translate(table)


def one_down(txt):
	try:
		return ''.join(('Z' if i == 'A' else 'z' if i == 'a' else chr(ord(i) - 1) if i.isalpha() else i for i in txt))
	except:
		return 'Input is not a string'


def one_down(txt):
	if type(txt) is not str:
		return 'Input is not a string'
	new_string = ''
	for char in txt:
		if char == ' ':
			new_string = new_string + ' '
		elif char == 'A':
			new_string = new_string + 'Z'
		elif char == 'a':
			new_string = new_string + 'z'
		elif char in '-+,.;:':
			new_string = new_string + char
		else:
			new_string = new_string + chr(ord(char) - 1)
	return new_string


def one_down(txt):
	if isinstance(txt, list) or isinstance(txt, int):
		return 'Input is not a string'
	Decode = list(map(ord, txt))
	txt = ''
	for x in Decode:
		if x < 65 or x > 122:
			txt += chr(x)
		elif x == 65 or x == 97:
			txt += chr(x + 25)
		else:
			txt += chr(x - 1)
	return txt


def one_down(txt):
	if type(txt) != str:
		return 'Input is not a string'
	return ''.join((chr(65 + (ord(i) - 66) % 26) if i.isupper() else chr(97 + (ord(i) - 98) % 26) if i.islower() else i for i in txt))


def one_down(txt):
	if type(txt) != str:
		return 'Input is not a string'
	abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
	result = ''
	for x in txt:
		if x not in abc:
			result += x
		elif x in 'aA':
			result += 'zZ'['aA'.index(x)]
		else:
			result += abc[abc.index(x) - 1]
	return result