Question: Given a user playlist dataset,users, complete the functioncount_artist_strings(users)below so that it counts the number of distinct case-insensitive artist strings contained inusers. ex0_demo_users = [{'user_id': '0c8435917bd098dce8df8f62b736c0ed',

Given a user playlist dataset,users, complete the functioncount_artist_strings(users)below so that it counts the number of distinct case-insensitive artist strings contained inusers.

ex0_demo_users = [{'user_id': '0c8435917bd098dce8df8f62b736c0ed',

'playlists': [{'name': 'Starred',

'tracks': [{'artist': 'Andr Rieu',

'title': 'Once Upon A Time In The West - Main Title Theme'},

{'artist': 'Andr Rieu',

'title': 'The Second Waltz - From Eyes Wide Shut'}]}]},

{'user_id': 'fc799d71e8d2004377d6d8e861479559',

'playlists': [{'name': 'Liked from Radio',

'tracks': [{'artist': 'The Police', 'title': 'Every Breath You Take'},

{'artist': 'Lucio Battisti', 'title': 'Per Una Lira'},

{'artist': 'Alicia Keys ft. Jay-Z', 'title': 'Empire State of Mind'}]},

{'name': 'Starred', 'tracks': [{'artist': 'U2', 'title': 'With Or Without You'}]}]}]

pprint(ex0_demo_users) 

Looking across all users and playlists, this dataset has five (5)distinctartist strings:'Andr Rieu','The Police','Lucio Battisti','Alicia Keys ft. Jay-Z', and'U2'. Observe that'Andr Rieu'appears twice, but for our tally, we would count it just once. And if'the POLICE'had been in the data, then it would be consider the same as'The Police'.

def count_artist_strings(users): 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!