9.16 Hands-on Exercises
Practice programs reinforcing Python string concepts -- a log-level analyzer, an IP address extractor, a config file parser, and a password …
Practice programs reinforcing Python string concepts -- a log-level analyzer, an IP address extractor, a config file parser, and a password …
Frequently asked and scenario-based Python string interview questions covering immutability, slicing, join() vs +=, and classic coding …
The most common string bugs in Python -- expecting a method to mutate in place, mismatching find() and index() error behavior, off-by-one …
Reaching for join() instead of += in loops, f-strings as the default formatting choice, comparing strings with == rather than is, and …
The standard raw-text-to-structured-fields pipeline applied to real infrastructure text -- Apache/Nginx/syslog parsing, Amazon Resource …
Why string immutability makes join() outperform += in a loop by turning O(n^2) into O(n), PEP 393's variable-width memory representation, …
The re module -- match() vs search(), findall()/finditer(), sub()/split(), pattern compilation, capture groups and named groups, and …
Classic string algorithms built from the operators and methods covered earlier -- reverse, palindrome and anagram checks, character …
Built-in functions that operate on strings from the outside -- len(), max(), min(), sorted(), chr(), ord(), ascii(), repr(), and str() -- as …
The str type's built-in method set grouped by purpose -- case conversion, searching, validation, modification, splitting/joining, alignment, …
The three ways to format strings in Python -- percent-style, str.format(), and f-strings -- plus alignment, padding, number/currency/date …
Concatenation, repetition, membership testing, comparison, lexicographical ordering, iteration, and len() — the operators that work directly …
Positive and negative indexing, slicing with s[start:stop:step], why slicing never raises IndexError, extended slicing for reversal, and …
The full table of Python string escape sequences, including the less common octal and hex character codes, expanding on the introductory …
Single, double, and triple quotes, multiline and empty strings, raw strings for paths and regex, and why every Python 3 str is Unicode by …
What a string is, why it's the universal interface between a program and the outside world, how it's represented in memory, and why …
String concatenation, length, substring extraction, case conversion, splitting, and comparison in Bash.