Practice · Python

Practice String Methods

Transform and inspect strings with split/join/strip/lower/upper/replace/find and friends.

String Methodswarming python…

CSV planets to space‑separated titles

Write a function process_space_csv(csv_line) that takes a CSV string of planet names. The function should:

  1. Split the string on commas.
  2. Strip surrounding whitespace from each name.
  3. Ignore any empty entries.
  4. Convert each remaining name to title case (first letter capital, the rest lower).
  5. Return the cleaned names joined by a single space.

Examples

  • process_space_csv("earth, mars,Venus") returns "Earth Mars Venus".
  • process_space_csv("pluto,,Mercury") returns "Pluto Mercury".
Press Run to see output, or Check to grade against the tests.

Want a whole course built around string methods?

Start my path — free

Adaptive practice, streaks, projects with real code review. Free tier gates AI help, never content.