0

I am trying to replace "one" with "1" in the string entered by user but my code shows no output.please help

https://code.sololearn.com/cfHv2Q5e8qng/?ref=app

3rd Feb 2020, 8:27 PM
Prabhjot Singh
Prabhjot Singh - avatar
5 Réponses
+ 1
You need something like this? word =list(input().split()) x=0 while x<len(word): if word[x]=="one": word[x] = "1" x=x+1 print(word)
3rd Feb 2020, 8:32 PM
b068931
+ 1
word = input().split() for x in range(len(word)): if word[x]=="one": word[x] = "1" x+=1 print(" ".join(word))
3rd Feb 2020, 9:00 PM
rodwynnejones
rodwynnejones - avatar
0
Thank you very much
4th Feb 2020, 4:04 AM
Prabhjot Singh
Prabhjot Singh - avatar
0
Ok,i agree with the above two answers but i want the reason why my code wasn't working,why we can't do that?
4th Feb 2020, 4:06 AM
Prabhjot Singh
Prabhjot Singh - avatar
0
"replace" unsupported in the list object
4th Feb 2020, 5:51 AM
b068931