Hi! I'm trying to do this exercise. It's in spanish but only some few words and some of them are not even spanish words so I hope language isn't a barrier. The error is this:
"¡Uy! Probá otra vez. ¿Tu función de censura tiene exactamente dos argumentos? ¿una cadena de texto y una palabra para reemplazar con asteriscos?Tu codigo mostro el error "'str' object does not support item assignment"."
I couldn't prove my prototype so maybe is fill of mistakes but I can't run the program and this is the reason but I can't fix it or/and understand it.
Thank you for read me
P.S.: I don't understand very well how it is supposed to use the boolean form. An error appears when I put "mem=True" in the "while" and I don't know if "is" means is (verb to be) and, well, help will be welcome
def censor (texto, palabra): testo = str(texto) pallabra= str(palabra) mem=False contador=0 for i in range(len(testo)): if testo[i]==pallabra: mem = True contador=0 while mem is True and contador<len(pallabra): for j in range(len(pallabra)): if testo[i+j]!=pallabra[j]: mem = False else: contador+=1 else: if contador==len(pallabra): for j in range (len(pallabra)): testo[i+j]="*" return testo