+ 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

25th Jan 2017, 8:18 AM
kumar badal
kumar badal - avatar
2 Respuestas
+ 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)
25th Jan 2017, 8:39 AM
Kawaii
Kawaii - avatar
0
x=124.456 print(x) x="This was a string" print(x + ".")
26th Jan 2017, 5:55 PM
Tummala Kethan
Tummala Kethan - avatar