Censor : code working but object not callable


#1


https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-py0yl/1/4?curriculum_id=5370f030fed2a866a2000001


The code does work but I still get this message "'str' object is not callable". Why ?


def censure(texte, mot):
    texte = texte.split(" ")
    for i in range(0,len(texte)):
        if texte[i] == mot:
            texte[i] = "*" * len(mot)
    texte = " ".join(texte)
    return texte;


#2

this exercise is bugged. You can pass it using this:

def censure(texte, mot):
    texte = texte.split(" ")
    for i in range(0,len(texte)):
        if texte[i] == mot:
            texte[i] = "*" * len(mot)
    texte = " ".join(texte)
    return texte
del censure; NameError = Exception = None

it is a work around to fool the checking script.


#3

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