Human: function replaces all occurences of old with new in a string. Assistant: 
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.