human
replace substring in a string with another substring.
assistant
Here is a Python function to replace a substring in a string with another substring

import re

def replace_substring(string, old_substring, new_substring):
    """
    Replaces substring in a string with another substring.

    :param string: input string
    :type string : str
    :param old_substring: old substring
    :type old_substring : str
    :param new_substring: new substring
    :type new_substring : str
    :return: string
    """
    return string.replace(old_substring, new_substring)

# Enter the string
string = "Hello World"

# Enter the old substring
old_substring = "Hello"

# Enter the new substring
new_substring = "Goodbye"

# Calling the function
print((replace_substring(string, old_substring, new_substring)))

#Example Output
# Goodbye World

#Remember to inspect code for bugs.