Censor (Unicode Decode Error)


#1


https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/4?curriculum_id=4f89dab3d788890003000096#

Hello,

The code gives me the following error "Traceback (most recent call last):
File "python", line 12, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 19: ordinal not in range(128)" and I can not figure it out after searching for the possible erors for one hour.


I would appreciate your help.
Thanks in advance!


text="naber olum manyak mısın olum"
word="olum"
def censor(text, word):
    splitted = text.split()
    ben=[]
    for i in range(len(splitted)):
        if splitted[i] == word:
            ben.append(len(word)* "*")
        else:
            ben.append(splitted[i])
    return " ".join(ben)
print censor(text, word)


#2

Make sure you're using plain Latin characters. Some Unicode characters are not accepted.


#3

Ohhhh, thank you SO much, I didn't notice that!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.