It can only go into one of the if
or elif
or else
branches (and it can never go into elif
for :
because the if
already captures that). You need to add stuff to the output string in all of these cases, probably outside the conditional.
However, you are examining one letter at a time, so :
followed by anything will add ? and )
anywhere else in the line will do that too; and (
anywhere will trigger ☹️
A better approach altogether is perhaps
def emojiChanger(word):
return word.replace(':)', '?').replace(':(', '☹️')
solved My translator does not output what i want it to [closed]