Checkpoint 1.5.5. 1. Implement find_favorite_songs & Test It.
Recall your
find_favorite_songs(library) skeleton from Section 4, which returns a list of titles for songs rated at least 4. Now, write the full implementation and test it thoroughly:
-
Validate
library: ensure it’s notNoneor empty, and each element is[title, rating, play_count]. -
Loop through songs, check if
rating >= 4, and append thetitleto a result list. -
Return that result list.
Write at least one test that verifies this logic, plus a test for invalid input. Refine until everything passes.
