+ 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 Odpowiedź
+ 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