This object is simply a Python list of Python sets, with the "outer list containing playlists and each playlist consisting only of distinct artist strings (without postprocessing per Exercise 2-we'll handle that later). Exercise 3: extract_playlists (2 points) Complete the function, extract_playlists(users), so that it returns the simplified list of artist names as shown above. For instance, calling extract playlists(exe_deno users) should return an object that matches ex3_demo_output. Note : You should not process the artist names per Exercise 2, that step comes later Note 1: You should preserve the exact order of playlists from the input. That is, you should loop over users and playlists in the order that they appear in the input and produce the corresponding output in that same order. Note 2 Do not forget that the final output should be a Python list (holding playlists) of Python sets (unprocessed artist names) Note 3 Your function should not modify the input dataset, In (396): def extract_playlists(users): ### YOUR CODE GOES HERE File "
Line 4 SyntaxError: unexpected EOF while parsing In (316): # Demo cell ex3_your_output extract.playlists (exe_demo users print("-w. Your output) pprint(exx_your_output) assert alla - b for a, b in ip(ex3 your output, ex3 demo output)). "Your output does not match the demo output print(" (Your output matches the demo output - so far so good) TypeError Traceback (most recent call last) EL To make sure you know how to navigate these data, lot's start with two basic exercises Exercise 0: count_playlists (1 point) Given a user playlist dataset, users, complete the function, count_playlists(users) so that it returns the total number of playlists For instance, suppose the user dataset consists of the following two users In [362]: exe_demo_users - 'user_id": "0c8435917bd9dce8df8f62b736coed, playlists': ((nane: 'Starred, 'tracks: ('artist'Andr Rieu "title Once Upon A Time In The West - Main Title Thesa'). {artist'Andre Rieu, title's The Second Malta From Eyes Wide Shut1)). ('user_id' f99d71d2004377d6d8e861479559 playlists: Canet Lived froe Radio tracks artist The Police'title': "Every Breath You Take'). Carti Lucio Battisti 'title! Per Una Lira) fartisti Alida Keys Fayz, 'title't 'Empire State of Mind'). [name Standartist U2' 'title' with Or Without You)131) Then count_playlists(exe_demo_users) would return 123, because the first use one playlist (named 'Starred") and the second has two playlists (one named 'Liked from Radio and the other as named 'Starred In (392): def count_playlists(users): W BEGIN SOLUTION C for user in users 6+ (usert olaylists retine In (393] Demo cell count playlistex demo_users) should return Out[393]: 3 In (394): # Test cell count playstal point AUTOGRADEN TEST DO NOT REMOVE we from testing tools Import we check print("exting...) SA This object is simply a Python list of Python sets, with the "outer list containing playlists and each playlist consisting only of distinct artist strings (without postprocessing per Exercise 2-we'll handle that later). Exercise 3: extract_playlists (2 points) Complete the function, extract_playlists(users), so that it returns the simplified list of artist names as shown above. For instance, calling extract playlists(exe_deno users) should return an object that matches ex3_demo_output. Note : You should not process the artist names per Exercise 2, that step comes later Note 1: You should preserve the exact order of playlists from the input. That is, you should loop over users and playlists in the order that they appear in the input and produce the corresponding output in that same order. Note 2 Do not forget that the final output should be a Python list (holding playlists) of Python sets (unprocessed artist names) Note 3 Your function should not modify the input dataset, In (396): def extract_playlists(users): ### YOUR CODE GOES HERE File " Line 4 SyntaxError: unexpected EOF while parsing In (316): # Demo cell ex3_your_output extract.playlists (exe_demo users print("-w. Your output) pprint(exx_your_output) assert alla - b for a, b in ip(ex3 your output, ex3 demo output)). "Your output does not match the demo output print(" (Your output matches the demo output - so far so good) TypeError Traceback (most recent call last) EL To make sure you know how to navigate these data, lot's start with two basic exercises Exercise 0: count_playlists (1 point) Given a user playlist dataset, users, complete the function, count_playlists(users) so that it returns the total number of playlists For instance, suppose the user dataset consists of the following two users In [362]: exe_demo_users - 'user_id": "0c8435917bd9dce8df8f62b736coed, playlists': ((nane: 'Starred, 'tracks: ('artist'Andr Rieu "title Once Upon A Time In The West - Main Title Thesa'). {artist'Andre Rieu, title's The Second Malta From Eyes Wide Shut1)). ('user_id' f99d71d2004377d6d8e861479559 playlists: Canet Lived froe Radio tracks artist The Police'title': "Every Breath You Take'). Carti Lucio Battisti 'title! Per Una Lira) fartisti Alida Keys Fayz, 'title't 'Empire State of Mind'). [name Standartist U2' 'title' with Or Without You)131) Then count_playlists(exe_demo_users) would return 123, because the first use one playlist (named 'Starred") and the second has two playlists (one named 'Liked from Radio and the other as named 'Starred In (392): def count_playlists(users): W BEGIN SOLUTION C for user in users 6+ (usert olaylists retine In (393] Demo cell count playlistex demo_users) should return Out[393]: 3 In (394): # Test cell count playstal point AUTOGRADEN TEST DO NOT REMOVE we from testing tools Import we check print("exting...) SA