Question: Markdown Exercise 1: count_artist_strings (1 point) For your next task, suppose we wish to count how many distinct case-insensitive artist strings are in the dataset
Markdown Exercise 1: count_artist_strings (1 point) For your next task, suppose we wish to count how many distinct case-insensitive artist strings are in the dataset (across all users and playlists) By distinct case-Insensitive." we mean two strings a and b would be "equal" if, after conversion to lowercase, they are equal in the Python sense of a b. For example, we would treat Jay-Z' and 'JAY-Z' as equal, but we would regard Jay-Z (with a hyphen) and Jay Z" (without a hyphen) an unequal. In a subsequent exercise, we will try to normalize names in a different way. Your task. Given a uses playlist dataset, users, complete the function count artist_string(users) below so that it counts the number of distinct dase- insensitive artist strings contained in users. For example, recall the demo dataset from Exercise 0: In ): pprint(exe_demo users) Looking across all users and playlists, this dataset has five (5) distinct artist 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 Note: Your function must not modify the input dataset. Even if your code returns a correct result, if it changes the input data, the autograder wim mark it as incorrect. Int: def count_artist strings(users): WW YOUR CODE HERE In [306]: Demo: Should return '5 count artist strings (exo deno_users) AttributeError Traceback (most recent call last) cipython-input-386-6fe8b7f1ff37> in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
