← 2023 questions

2023 / SPOTIFY / QUESTION 9

Mood playlist

Try the question in your own editor, then check your output below.

THE QUESTION

Vignesh discovers an artist, Laufey, on Spotify, however, he isn’t sure what songs to start with. He has heard the hits but he wants to find some deep cuts that he’d actually like. Vignesh prefers slow and sad songs. Create a Laufey playlist prioritising songs with slow and sad properties.

Starter code:

songs = [["above the chinese restaurant", "slow", "sad"],
["love to keep me warm", "fast", "upbeat"],
["let you break my heart again", "slow", "sad"],
["street by street", "upbeat"], ["like the movies", "slow"],
["falling behind", "fast", "sad"],
["the christmas waltz", "slow", "upbeat"],
["i wish you love", "fast", "sad"], ["someone new", "slow", "sad"],
["james", "slow"]]
playlist = []

Question by Ariz. Source: Girls In Code SEA — Behind the Screens, 2023, slide 24.

PRACTICE CHECK

Try your answer.

This checkpoint checks the highest-priority group, rather than prescribing an order for the remaining playlist.

Run your program in your own editor, then paste its output below. This checks the stated output or checkpoint; it does not assess your full program. Practice attempts do not affect competition scores.

Enter only the songs tagged both slow and sad, as a list or one per line.

Reveal worked answer

Songs with both preferred properties · one valid answer

["above the chinese restaurant", "let you break my heart again", "someone new"]

Filter songs where both “slow” and “sad” appear in the properties.