BugHunt

Python string exercises

Strings are where most Python beginners meet their first real bug: an index one past the end, a method whose result was never kept, a number glued to text. Each exercise here is a short function that handles text and has exactly one thing wrong.

Read the symptom, find the line, fix it, and run the tests. They run in your browser with real Python, so there is nothing to install.

See the 16 exercisesOr follow the 30-day path

The strings bugs you will meet

The exercises

Errors you might be searching for

More Python practice by topic

Questions

Are these good for beginners?

Yes. They are sorted easy first, each is a few lines long, and the hints get warmer one at a time if you are stuck.

Where are the solutions?

Every exercise explains the bug once you have fixed it. Sign in and you can also compare your fix with the reference solution.