This lesson is an example of Python dictionary data structure. In this lesson, we are going to build an emoji converter using Python Dictionary Data-structure.
The Python code used in this lesson:
message = input("Type your message: ")
separate_words = message.split(' ')
print(separate_words)
emoji = {
":)": "😊",
":(": "☹"
}
output = ""
for word in separate_words:
output += emoji.get(word, word) + " "
print(output)
‘You are free to copy, edit, use and distribute this code without crediting the author. Enjoy copyright-free content.’ – Nuruzzaman Faruqui.