Create a Python program to replace all occurance of a target string in a sentence with a replacement string.
Sentence: “Hello world, this is a sample text. We needed to replace the word “world” with “Earth”
Target: world
Replacement: Earth
sentence = "Hello world, this is a sample text. We needed to replace the word “world' with “Earth”"
target = "world"
replacement = "Earth"

def replace_string(sentence, target, replacement):
 return sentence.replace(target, replacement)
 
updated_sentence = replace_string(sentence, target, replacement)
 
print(updated_sentence) 

# Output: Hello Earth, this is a sample text. We needed to replace the word “world' with “Earth”