101k views
0 votes
Assume there is a variable, album_artists, that is associated with a dictionary that maps albums to performing artists. Write a statement that inserts the key/value pair: "Live It Out"/"Metric"

User Mwaskom
by
6.6k points

1 Answer

1 vote

Answer:

Following are the program in the Python Programming Language.

#define function.

def album():

#set dictionary data type variable

album_artists = dict()

#Initialize the key and value in the dictionary

album_artists["Live It Out"] = "Metric"

#dispaly the dictionary.

print(album_artists)

#call the function

album()

Output:

{'Live It Out': 'Metric'}

Step-by-step explanation:

Here, we define function "album()" and inside the function.

  • Set dictionary data type variable "album_artists" through built-in function "dict()".
  • Initialize the key and the value inside the dictionary type variable "album_artists".
  • Then, print the following dictionary through the print() function.

Finally, call the following function "album()".

User Superup
by
5.5k points