# Name: ... # CSE 160 # Autumn 2023 # Checkin 9 class StreamingService: def __init__(self): """ Creates a new streaming service with initially no artists or songs. """ self.song_dict = {} # Feel free to add new fields if necessary def add_song(self, artist, song): """ Add a song to the artist's inventory in the streaming service. If the artist already exists in the streaming service, add the song to the artist's existing catalogue of songs. Arguments: artist: a string which represents the name of the artist song: a string which represents the name of the song Returns: None. """ # Your solution code goes here def song_inventory(self): """ Return a set of tuples with the tuples in the format (artist_name, song_name), which represents all of the current artists and songs in the streaming service. """ # Your solution code goes here def num_artists(self): """ Return the number of unique artists in the streaming service. """ # Your solution code goes here s = StreamingService() empty = StreamingService() # Test add_song s.add_song("WayV", "On My Youth") assert "WayV" in s.song_dict.keys() assert "On My Youth" in s.song_dict["WayV"] s.add_song("WayV", "Try My Luck") assert "WayV" in s.song_dict.keys() assert "Try My Luck" in s.song_dict["WayV"] s.add_song("Olivia Rodrigo", "vampire") assert "Olivia Rodrigo" in s.song_dict.keys() assert "vampire" in s.song_dict["Olivia Rodrigo"] # Test song_inventory assert s.song_inventory() == {("WayV", "On My Youth"), ("WayV", "Try My Luck"), ("Olivia Rodrigo", "vampire")} assert empty.song_inventory() == set() # Test num_artists assert s.num_artists() == 2 assert empty.num_artists() == 0