Respuesta :
Answer:
def add_album(artist,album):
song_list = input("enter the list of song titles separated by comma: ").split(",")
print(song_list)
year = int(input("enter release year: "))
is_platinum = bool(input("Is it platinum? True/False"))
music[artist][album] = {}
music[artist][album]['songs'] = song_list
music[artist][album]['year'] = year
music[artist][album]['platinum'] = is_platinum
def add_artist():
artist = input("enter name of artist: ")
if music.get(artist, "no") == "no":
music[artist] = {}
else:
print("artist already exist in dictionary.")
is_album = input("add album? ")
if is_album == "yes":
album_name = input("Enter album name: ")
add_album(artist,album_name)
for _ in iter(dict, 0):
is_exist = input("Do you want to end the program? yes/no: ")
if is_exist == "yes":
break
elif is_exist == "no":
is_art = input("Add artist? ")
if is_art == "yes":
add_artist()
else:
print("enter yes/no")
else:
print("make a decision, yes/no")
Explanation:
The python program defines an "add_artist" and "add_album" function that references the dictionary "music". The functions prompt for user inputs of the artist name, album, year, and platinum record.
The functions use the bracket notation to access and update the dictionary in the memory.