7.6 / 10: 123...

: The while True ensures the code keeps searching until every instance is gone, which is necessary if the letter appears multiple times (e.g., removing "na" from "banana"). Alternative (Standard Python)

: If letter is an empty string, the loop would run forever; we return the original word immediately. 7.6 / 10 123...

def remove_all_from_string(word, letter): return word.replace(letter, "") Use code with caution. Copied to clipboard : The while True ensures the code keeps

You can solve this using a while loop to repeatedly find and remove the target substring until it no longer exists in the word. the loop would run forever

Scroll to Top