# 7kyu - The Hidden Word

""" 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. """


# def hidden(num):
#     keys = dict(a=6, b=1, d=7, e=4, i=3, l=2, m=9, n=8, o=0, t=5)
#     for x in keys:
#         keys[x] = str(keys[x])
#     inverted = dict(map(reversed, keys.items()))
#     return ''.join(inverted[x] for x in str(num))

# def hidden(num):
#     keys = dict(a=6, b=1, d=7, e=4, i=3, l=2, m=9, n=8, o=0, t=5)
#     inverted = dict(map(reversed, keys.items()))
#     return ''.join(inverted.get(int(x)) for x in str(num))

def hidden(num):
    trans = dict(zip('6174329805', 'abdeilmnot'))
    return ''.join(trans[x] for x in str(num))


# "Expected '637` to return 'aid'"
q = hidden(637)  # "aid"
q

# "Expected '7415` to return 'debt'"
q = hidden(7415)  # "debt"
q

# "Expected '49632` to return 'email'"
q = hidden(49632)  # "email"
q

# "Expected '942547` to return 'melted'"
q = hidden(942547)  # "melted"
q
