trim_variants(s) that returns a tuple (both, left_only, right_only) where both has whitespace stripped from both ends, left_only has only the leading whitespace stripped, and right_only has only the trailing whitespace stripped.s = ' hi '
('hi', 'hi ', ' hi')strip() removes both sides, lstrip() only the left, rstrip() only the right.
`str.strip()`, `str.lstrip()`, `str.rstrip()` are the three tools you need.