This tool is donation based and free. 🙏 We're looking for donations to keep it running — $360/year covers our server costs.

$18 of $360 · 5%
Donate
This fact check is over 3 months old. The situation may have changed significantly — please recheck before relying on it.

Code Claim: Replacing World with DNA in Hello, World! Results in Hello, DNA!

“is this unrestricted text = 'Hello, World!' new_text = text.replace('World', 'DNA') # Replace 'World' with 'DNA' print(new_text) # Output: Hello, DNA!”
True
Confidence: High Checked on May 24, 2026

Summary

The Python `replace()` method substitutes all occurrences of a specified substring and returns a new string without altering the original. Applying `text.replace('World', 'DNA')` to the string `"Hello, World!"` correctly produces `"Hello, DNA!"`. Hence, the described output is accurate.

Recheck this fact Runs a fresh check with up-to-date sources

Sources 40 searched

geeksforgeeks.org
  • Python String replace() Method - GeeksforGeeks

    The replace() method replaces all occurrences of a specified substring in a string and returns a new string without modifying the original string. Let’s look at a simple example of replace() method. ... s = "Hello World!

  • Python String replace() Method - GeeksforGeeks

    hello world!" res1 = s.replace("Hello", "Hi") res2 = s.replace("hello", "hi") print(res1) print(res2)

mimo.org
tutorialgateway.org
  • Python String Replace

    Here, we are changing l with M. ... If we change the argument values as (‘o’, ‘ABC’), this method substitutes o with ABC from Hello World, and the output will be ‘HellABC WABCrld’.

docs.python.org
python-academy.org
  • replace — Python Function Reference

    A comprehensive guide to Python functions, with examples. Find out how the replace function works in Python. Return a copy of the string with all occurrences of substring old replaced by new.

This fact check is free and donation-based. $1 powers ~30 fact-checks.

Donate $1 to support fact-checking

Check another fact