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)
Expected Outputs
`> 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, ????
`
Expected outputs with errors
- 🙂 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 ?????
The error in point 3 and point 4, is what I am getting, but I am unable to understand what does that mean. So I don’t really know how to fix that. Can somebody please help?
4