Maya writes weekly articles to a well known magazine, but she is missing one word each time she is about to send the article to the editor. The article is not complete without this word. Maya has a friend, Dan, and he is very good with words, but he doesn't like to just give them away. He texts Maya a number and she needs to find out the hidden word. 
The words can contain only the letter: "a", "b", "d", "e", "i", "l", "m", "n", "o", and "t".

Luckily, Maya has the key:

"a" - 6
"b" - 1 
"d" - 7
"e" - 4
"i" - 3
"l" - 2
"m" - 9
"n" - 8
"o" - 0
"t" - 5

You can help Maya by writing a function that will take a number between 100 and 999999 and return a string with the word. 

The input is always a number, contains only the numbers in the key. 
The output should be always a string with one word, all lowercase.

Maya won't forget to thank you at the end of her article :)

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def hidden(num):
	

Solutions:
hidden = lambda n: ''.join(('oblietadnm'[int(d)] for d in str(n)))


trans = dict(zip('6174329805', 'abdeilmnot'))

def hidden(num):
	return ''.join((trans[char] for char in str(num)))


def hidden(num):
	return str(num).translate(str.maketrans('6174329805', 'abdeilmnot'))


def hidden(num):
	d = 'oblietadnm'
	return ''.join([d[int(i)] for i in str(num)])


def hidden(num):
	num_by_char = {'6': 'a', '1': 'b', '7': 'd', '4': 'e', '3': 'i', '2': 'l', '9': 'm', '8': 'n', '0': 'o', '5': 't'}
	return ''.join((num_by_char[n] for n in str(num)))


def hidden(num):
	key = {6: 'a', 1: 'b', 7: 'd', 4: 'e', 3: 'i', 2: 'l', 9: 'm', 8: 'n', 0: 'o', 5: 't'}
	out = ''
	while num > 0:
		out += key[num % 10]
		num //= 10
	return out[::-1]


a = '"a" - 6 "b" - 1 "d" - 7 "e" - 4 "i" - 3 "l" - 2 "m" - 9 "n" - 8 "o" - 0 "t" - 5'
d = {k: v for (v, k) in __import__('re').findall('\\"(\\w)\\"\\s-\\s(\\d)', a)}
hidden = lambda n: ''.join((d.get(x, '') for x in str(n)))