0
I am trying to replace "one" with "1" in the string entered by user but my code shows no output.please help
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)
+ 1
word = input().split()
for x in range(len(word)):
if word[x]=="one":
word[x] = "1"
x+=1
print(" ".join(word))
0
Thank you very much
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?
0
"replace" unsupported in the list object