Python ProgrammingPython Programming

Python string replace character

s = "The quick brown fox jumps over the lazy dog"
for r in (("brown", "red"), ("lazy", "quick")):
    s = s.replace(*r)

print(s)
Output
The quick red fox jumps over the quick dog