Lesson 1 of 6
Clean the inputs
Real data arrives dirty: stray spaces, inconsistent casing. First step of every pipeline: normalise.
strip() removes edge whitespace, lower() unifies the casing — composable in one expression.
def clean(s):
return s.strip().lower()🎯 Exercise
Write the clean(s) function that returns s without edge whitespace and in lowercase, then print clean(" Ada ").
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →