Your question is Search and Split a String. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The Zappos Family catalog processes product labels that use a single character as a separator. Implement a custom split operation without calling Python's built-in str.split.
Given a string text, a one-character separator, and a nonnegative integer max_splits, return the pieces produced by scanning from left to right. Split at each separator until max_splits splits have been made. If max_splits is 0, return the entire string as one piece. Preserve empty pieces caused by leading, trailing, or consecutive separators. Any remaining separator characters after the limit belong to the final piece.
text, a string; separator, a string containing exactly one character; and max_splits, a nonnegative integer.str.split or regular expressions.def split_by_character(text, separator, max_splits):