Replacing number in a string by 0(zero) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Replacing number in a string by 0(zero)

This is my code. it does not work. My goal is to replace numbers in the string by 0 str=input() for i in range(len(str)): if ord(str[i])>=48 and ord(str[i])<=57: str.replace(str[i],"0") print(str) //Help me...

10th Jun 2020, 10:25 PM
Md. Saiful Islam
Md. Saiful Islam - avatar
1 Answer
+ 1
str=input() for i in range(len(str)): if ord(str[i])>=48 and ord(str[i])<=57: str=str.replace(str[i],"0") print(str)
10th Jun 2020, 10:28 PM
Abhay
Abhay - avatar