In this lesson, we will learn how to reuse a reusable part of a program as a function.
The Python code used in this lesson:
def emoji_converted(message):
separate_words = message.split(' ')
emoji = {
":)": "😊",
":(": "☹"
}
output = ""
for word in separate_words:
output += emoji.get(word, word) + " "
return output
message = input("Type your message: ")
result = emoji_converted(message)
print(result)
‘You are free to copy, edit, use and distribute this code without crediting the author. Enjoy copyright-free content.’ – Nuruzzaman Faruqui.
Watch video Reusables in Function online without registration, duration hours minute second in high quality. This video was added by user Nuruzzaman Faruqui 25 September 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 427 once and liked it 3 people.