+ 1
x = 123.456 print(x) x = "This is a string" print(x + ".")
in the above progran what if we want to replace the word "is" with "was" is it possible? if yes what would be the code look like
2 Answers
+ 6
x = "This is a string"
x= x.replace(" is ", " was ") # Note the spaces right and left of the words, if u dont put spaces it will show "Thwas was a string"
print(x)
0
x=124.456
print(x)
x="This was a string"
print(x + ".")