A transformation takes an input and produces a result that another operation can use. Functional programming emphasizes this flow, especially when each step leaves its input unchanged. Python supports that style alongside loops and classes; it does not enforce it.
def clean_label(text: str) -> str:
trimmed = text.strip()
return trimmed.lower()
raw = " MAPLE "
print(clean_label(raw))
print(repr(raw))
maple
' MAPLE '
strip produces "MAPLE", then lower produces "maple". Strings are immutable: neither step alters raw. The annotations describe expected input and output types for readers and tools; they do not validate arguments automatically.
" MAPLE " -> strip -> "MAPLE" -> lower -> "maple"
Naming intermediate results helps locate the first unexpected value. repr makes spaces visible when debugging. The pipeline emphasizes what each stage produces; Python still performs steps. A loop or a class can coexist with functional techniques, and a short expression is not automatically clearer or pure.