I am learning python from Harvard CS50 Introduction to python course, and got this emoji question.
But got really stuck with few input values, and I am unable to understand the actual error/solve the error.
Question:
In a file called emojize.py, implement a program that prompts the user for a str in English and then outputs the “emojized” version of that str, converting any codes (or aliases) therein to their corresponding emoji.
My Code:
import emoji
a = str(input("Input: ")).strip()
b = emoji.emojize(a)
print("Output:",b)
Here’s how to test the code
`> python emojize.py
Input: :thumbs_up:
Output: ????
python emojize.py
Input: :thumbsup:
Output: ????
python emojize.py
Input: hello, :earth_africa:
Output: hello, ????
python emojize.py
Input: hello, :earth_americas:
Output: hello, ????
python emojize.py
Input: hello, :earth_asia:
Output: hello, ????
`
I am getting this kind of error
🙂 emojize.py exists
🙂 input of “:1st_place_medal:” yields output of ????
🙁 input of “:thumbsup:” yields output of ????
expected “????”, not “Input: Output:…”
🙁 input of “hello, :earth_asia:” yields output of hello, ????
expected “hello, ????”, not “Input: Output:…”
🙂 input of “:candy: or :ice_cream:?” yields output of ???? or ?????
How do I fix the errors? Can somebody please help?