Strings

Python String Interview Questions

String questions are about cleaning and comparing text: splitting a field, stripping spaces, matching two identifiers that should be the same and are not quite. It is the daily work of getting two systems to agree.

What string questions ask you to do

Across the questions here, these are the shapes that come up:

  • Match two values that differ only in case or spacing
  • Split a field on a separator
  • Pull out part of a value by its pattern
  • Check a property of the characters themselves
  • Build one key out of several columns

Common mistakes with strings

Compare the cleaned-up versions, not the raw ones. Case and trailing spaces account for more wrong answers here than any clever parsing does. In pandas the text methods also return nothing wherever the input was empty, so a filter built on one quietly drops those rows.

Questions to practice

Roles this comes up in

Companies these come from

Other topics