Friday, Jul 24, 2026 The claims desk. Receipts included. POWERED BY LENZ
IsThis

TECH

The Claim

A Python program can be written to replace all occurrences of the first character in a string with '$', except for the first character itself.

The Short Version

The described task is straightforwardly achievable in Python. Multiple independent sources provide working code — typically combining string slicing with `str.replace()` — that replaces all occurrences of the first character with '$' while preserving the first character itself. The claim says only that such a program "can be written," and the evidence unanimously confirms this. The sole nuance is that Python strings are immutable, so the result is a new string rather than an in-place modification.

Caveats

  • Python strings are immutable; the operation produces a new string rather than modifying the original in place.
  • No single built-in method performs this exact operation — standard solutions combine string slicing with str.replace() or use a two-step replace-then-restore approach.
  • Edge cases (e.g., empty strings or strings where the first character appears only once) are not addressed by the claim but may matter in practice.

The Receipts

  1. str.replace — Python 3.12 documentation

    Python Official Documentation

  2. Python - Replace occurrences by K except first character

    GeeksforGeeks

  3. Python Program to Replace occurrences by K except first character - TutorialsPoint

    TutorialsPoint

  4. Remove All Characters Except Letters and Numbers - Python - GeeksforGeeks

    GeeksforGeeks

  5. How to Replace a String in Python

    Real Python

  6. Python String replace()

    Programiz

  7. Python String.Replace() – Function in Python for Substring Substitution - freeCodeCamp

    freeCodeCamp

  8. Removing all but one instance of a phrase from a string - Python Help

    Python.org Discuss

  9. Python String replace() Method

    GeeksforGeeks

  10. Python: Get a string from a given string where all occurrences of its ...

    w3resource

+ 6 more sources — see the full list on Lenz

Filed Under

Python

More Fact Checks