Unit 3 Task 3 - Solution

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Solution - Task 3: Build a playlist

← Back to task


One possible program:

playlist = []

while True:
    title = input("Song title (blank to finish): ")
    if title == "":
        break
    playlist.append(title)

print("Playlist has", len(playlist), "song(s):")
for index in range(len(playlist)):
    print(str(index + 1) + ".", playlist[index])