Working with dictionaries
You've been busy, adding more artists and songs to your playlist
dictionary in preparation for the party!
As a reminder, it contains artist names as keys and song names as values.
In this exercise, you'll access parts of the dictionary as well as adding a new artist and song.
This exercise is part of the course
Introduction to Python for Developers
Exercise instructions
- Print the name of the song in the
playlist
that is by the artist"Coldplay"
. - Add a new key-value pair to the
playlist
, where the key is"Usher"
and the value is"Yeah!"
. - Print only the songs in the
playlist
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Print the song by Coldplay
print(____)
# Add a new song
____
# Print the songs in the playlist
print(____)