๐Ÿ PyQuest๐Ÿญ Function Factory ยท ๐Ÿค– Mission: Emoji Translator 3000
โญ 0 XP๐Ÿ Python is waking upโ€ฆ

Mission: Emoji Translator 3000 ๐Ÿค–

Final build of the Function Factory: a machine that turns words into emoji.

You'll combine functions, return, and the dictionary you learned in Unit 4. Here's the idea:

emoji_book = {"cat": "๐Ÿฑ", "pizza": "๐Ÿ•"}

def translate(word):
    if word in emoji_book:
        return emoji_book[word]
    return "๐Ÿคท never heard of it"

print(translate("cat"))       # โžœ ๐Ÿฑ
print(translate("banana"))    # โžœ ๐Ÿคท never heard of it

That last return is the default โ€” it catches every word your translator doesn't know, so it never hands back nothing.

(You could use if / elif / else instead of a dictionary. Both work! The dictionary is way less typing once you know a lot of words.)

Your mission

  1. Build a function translate(word) that returns an emoji
  2. Teach it at least 4 words (a dictionary, or a stack of elifs)
  3. Give it a default answer for words it doesn't know
  4. Call translate at least 3 times and print each result

No input() for this one โ€” just call translate("cat") with words you pick yourself, so the machine can be tested. ๐Ÿค–

Your code

Press โ–ถ Run to see what your code does!