OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Replacing some emoticons with emojis in python

  • Thread starter Thread starter Dawit Ashenafi
  • Start date Start date
D

Dawit Ashenafi

Guest
This is what my code currently looks like. I wanted to change the emoticons to emojis when the user inputs a sentence or word. How do I go by it?

Code:
def main():
    sentence = input("Input a Sentence: ")
    convert(sentence)
    print(sentence)


def convert():
    emo1 = ":)"
    emo2 = ":("
    emo1.replace(":)", "🙂")
    emo2.replace(":(", "🙁")


main()
<p>This is what my code currently looks like. I wanted to change the emoticons to emojis when the user inputs a sentence or word. How do I go by it?</p>
<pre><code>def main():
sentence = input("Input a Sentence: ")
convert(sentence)
print(sentence)


def convert():
emo1 = ":)"
emo2 = ":("
emo1.replace(":)", "🙂")
emo2.replace(":(", "🙁")


main()
</code></pre>
 

Latest posts

Top