Practice · Python

Practice Composing Helpers

Decompose a task into small functions and compose them, passing one function's output into another.

Composing Helperswarming python…

Total Playlist Duration

Write a function total_playlist_duration(durations: str) -> str that receives a single string containing a comma‑separated list of song lengths. Each song length is written as minutes:seconds (e.g. 3:15). The function must return the total length of the playlist, also formatted as minutes:seconds where seconds are always two digits.

Examples

total_playlist_duration("3:15, 4:05, 2:45")  # -> "10:05"
total_playlist_duration("")                     # -> "0:00"
Press Run to see output, or Check to grade against the tests.

Want a whole course built around composing helpers?

Start my path — free

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