practicepython.in
python exercises
171 exercises

Daily #10 · 8 October 2026

Stripping a banana Medium

What does this print?

print("banana".strip("an"))
  1. Ab
  2. Bban
  3. Cbanana
  4. Dbana
Show the answer

A: b

Why: strip("an") does not remove the text "an". It removes any a or n characters from both ends until it meets something else. removeprefix and removesuffix remove exact text.

Play today’s puzzle →