← 2023 questions

2023 / SPOTIFY / QUESTION 11

Spotify Wrapped

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

THE QUESTION

Who doesn't love Spotify Wrapped? Make a Spotify Wrapped for Vignesh. His song history has been compiled as a txt file (attached below) in the format “song;artist;genre;length of track”. Eg. Fireflies;Owl City;Pop;3:48.

Spotify listening history

The original input file could not be recovered. This question needs that dataset to reproduce the original exercise.

The Wrapped should include his top 5 artists, his top 5 songs, total minutes listened and his top genre (all determined individually based on how frequent they appear in his history).

(Explore how to open and read text files)

The correct output is:

Top Songs
1 Baby
2 FEVER
3 Easy
4 No Mercy
5 That's My Girl

Top Artists
1 Taylor Swift
2 5 Seconds of Summer
3 Queen
4 miss A
5 Ariana Grande

Top Genre
Pop

Minutes Listened
483

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

PRACTICE CHECK

Try your answer.

The original history file is unavailable, but the original slide supplies the complete expected output. This checks that published report.

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.

Paste the complete Wrapped report with its headings, ranked songs and artists, genre and minutes.

Reveal worked answer

Spotify Wrapped

Top Songs
1 Baby
2 FEVER
3 Easy
4 No Mercy
5 That's My Girl

Top Artists
1 Taylor Swift
2 5 Seconds of Summer
3 Queen
4 miss A
5 Ariana Grande

Top Genre
Pop

Minutes Listened
483

Count song, artist and genre occurrences; rank by count. Sum track durations and convert seconds to minutes.