<human>:  What is a good Python code to replace all occurences of old with new in a string? Python is a great programming language that replaces all occurence of old with a new one.
<bot>: Here is a Python code to replace all occurences of old with new in a string

import re

def replace(old, new, string):
  """
  >>> replace('a', 'b', 'a b c')
  'b b c'
  """
  return string.replace(old, new)

# Enter the string
string = "a b c"

# Enter the old and new strings
old = "a"
new = "b"

# Calling the function
print((replace(old, new, string)))

#Example Output
# b b c

#Remember to inspect code for bugs.