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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started