Question: I am stuck with this code. Need help ASAP. Live Channels You Follow - Twitch X zy Section 8.1 - 1&C SCI 31: Introduc X
I am stuck with this code. Need help ASAP.





Live Channels You Follow - Twitch X zy Section 8.1 - 1&C SCI 31: Introduc X C learn.zybooks.com/zybook/UCIICSC131Winter2021/chapter/8/section/1?content_resource_id=52191078 ili Apps " Twitch y Twitter @ Instagram @ Google YouTube M Gmail f Facebook N Dashboard (_) Canvas Calculus Zy Programming - ZyB... Planner T Checkout | Top Hat > Online Python Com... ICS 31 Style Checker Twice Baked Potato.. zyBooks My library > 1&C SCI 31: Introduction to Programming home > 8.1: LAB: ICS Tunes zyBooks catalog ? Help/FAQ @ philip moy You will write an application to manage music collections - a music collection is a list of albums. The named tuples used for Albums and Songs are defined below, and an example of a music collection is given. (DO NOT HARDCODE THE VALUES FOR MUSIC!) Album = namedtuple ('Album' , 'id artist title year songs') Song = namedtuple ('Song', 'track title length play_count' ) MUSIC = [ Album ("1", "peter Gabriel", " "Up", 2002, Song (1, "Darkness", 411, 5), Song (2, "Growing Up", 453, 5) ]) , Album ("2", "Simple Minds", "Once Upon a Time", 1985, [Song (1, "Once Upon a Time", 345, 9), Song (2, "All the Things She Said", 256, 10) ]) , Album ("TRS", "The Rolling Stones", "Let It Bleed", 1969, [Song (1, "Gimme Shelter", 272, 3), Song (2, "Love In Vain", 259, 2) , Song (3, "You Can't Always Get What You Want", 448, 10) ]) ] To achieve this, you need to: 1. Write a function called get_song_input that has no parameters. This function should prompt the user for the required information to create a new song, create the song and return it. You should require the information as follows: Enter the song's track: Enter the song's title: Enter the song's length: Enter the song's play_count: 2. Write a function called get_album_input that has no parameters. This function should prompt the user for the required information to create a new album, create the album and return it. You should require the information as follows: Enter the album's id: Enter the album's artist: Enter the album's title: Enter the album's year: Enter the number of songs in this album: Enter the song's track: Enter the song's title: Enter the song's length: Activate Windows Enter the song's play_count: Go to Settings to activate Windows. Note that the last four lines should be repeated once for each song in the album. Type here to search O 9 7:42 PM (7 ) 2/25/2021Live Channels You Follow - Twitch X zy Section 8.1 - 1&C SCI 31: Introduc X C learn.zybooks.com/zybook/UCIICSC131Winter2021/chapter/8/section/1?content_resource_id=52191078 ili Apps W Twitch Twitter @ Instagram @ Google YouTube M Gmail f Facebook N Dashboard () Canvas Calculus Zy Programming - ZyB.. Planner ?" Checkout | Top Hat Online Python Com. ICS 31 Style Checker Twice Baked Potato. zyBooks My library > 1&C SCI 31: Introduction to Programming home > 8.1: LAB: ICS Tunes LE zyBooks catalog ? Help/FAQ @ philip moy Note that the last four lines should be repeated once for each song in the album. 3. Write a function called add_album that takes a music collection (a list of albums) as a parameter. The function should create a new album, add it to the end of the list, and then return the updated collection. 4. Write a function called remove_album that takes a music collection (a list of albums) and an ID as parameters. The function should remove the album that has a matching ID from the list, and then return the updated collection. If there is no album with a matching ID, simply print 'Album not found.' and return the collection. 5. Write a function called favorite_song that takes a music collection and an album ID as parameters. The function returns the song that is the "favorite" from the album that matched the ID. We'll define the favorite song as the one that has the highest playing time. (The playing time of a song is computed as the product of its play_count and length.) If there is no album with a matching ID, return 'Album not found.. 6. Write a function called unplayed_songs that takes a music collection and an album ID as parameters. It should return a list of the songs that have not been played from the album that matched the ID. If there is no album with a matching ID, simply print and return 'Album not found.. 7. Write a function called favorite_album that takes a music collection and returns the album that is the "favorite." We'll define the favorite album as the one that has the highest playing time. (An album's playing time is the sum of all its songs' playing time.) 8. Write a function called unplayed_albums that takes a music collection and returns a list of the albums that have not been played. 9. Write a function called print_menu that has no parameters. This function should display the menu (as shown below), and prompt the user for a choice. It should repeat the message 'Choose an option' while the user does not input a valid choice. The function should return the valid choice the user entered. Note that you only print the entire menu once per valid choice. That is, if the user enters an invalid choice, you should not repeat the entire menu, only the 'Choose an option' message. MUSIC COLLECTION MANAGER add - Add a new album del - Remove an album fav_a - Print favorite album fav_s - Print favorite song not_a - Print not played albums not_s - Print not played songs exit - Exit the application Choose an option: 10. Finally, inside the main block of your code (if __name__= = '__main_), print the menu and perform the action the user requested until they request to exit the application. HINT: you can call get_song_input the desired amount of times to help create the list of songs for an album. Activate Windows HINT: you can create extra functions to help you. For instance, a function that takes a song as a parameter and calculates its playing time Go to Settings to activate Windows. could be helpful. HINT: print menu does not control the menu control logic - rather. it solely prints the menu and takes user input. Type here to search O 9 7:43 PM (1 )) 2/25/2021Live Channels You Follow - Twitch X zy Section 8.1 - 1&C SCI 31: Introduc X C learn.zybooks.com/zybook/UCIICSC131Winter2021/chapter/8/section/1?content_resource_id=52191078 ili Apps W Twitch Twitter Instagram G Google YouTube M Gmail f Facebook N Dashboard () Canvas Calculus Zy Programming - ZyB... Planner ?" Checkout | Top Hat ? Online Python Com... ICS 31 Style Checker Twice Baked Potato.. zyBooks My library > 1&C SCI 31: Introduction to Programming home > 8.1: LAB: ICS Tunes LE zyBooks catalog ? Help/FAQ @ philip moy Test definition of named tuple fields. Your output namedtuple () takes 2 positional arguments but 6 were given Test feedback Incorrect Tuple Name 2: Unit test ~ 0 /1 Checks the basic functionality of the function get_song_input Test feedback Incorrect Function Name 3: Unit test ~ 0/4 Test function get_song_input with 20 different songs Test feedback Incorrect Function Name 4: Unit test ~ 0 / 1 Checks the basic functionality of the function get_album_input Test feedback Incorrect Function Name 5: Unit test 0 / 4 Test function get_album_input with 20 different albums Test feedback Incorrect Function Name 6: Unit test ~ 0 /1 Checks the basic functionality of the function add_album Test feedback Incorrect Function Name 7: Unit test ~ 0/4 Test function add_album with many different albums Activate Windows Go to Settings to activate Windows. Test feedback Incorrect Function Name Type here to search O 9 7:43 PM (1 )) 2/25/2021Live Channels You Follow - Twitch X zy Section 8.1 - 1&C SCI 31: Introduc X C learn.zybooks.com/zybook/UCIICSC131Winter2021/chapter/8/section/1?content_resource_id=52191078 ili Apps W Twitch Twitter @ Instagram G Google YouTube M Gmail f Facebook N Dashboard ( ) Canvas Calculus Zy Programming - ZyB... Planner T Checkout | Top Hat ? Online Python Com... ICS 31 Style Checker Twice Baked Potato.. zyBooks My library > 1&C SCI 31: Introduction to Programming home > 8.1: LAB: ICS Tunes LE zyBooks catalog ? Help/FAQ @ philip moy Test feedback Incorrect Function Name 8: Unit test ~ 0 / 1 Checks the basic functionality of the function remove_album Test feedback Incorrect Function Name 9: Unit test ~ 0 /1 Checks the basic functionality of the function remove_album Test feedback Incorrect Function Name 10: Unit test ~ 0/1 Checks the basic functionality of the function remove_album Test feedback Incorrect Function Name 11: Unit test ~ 0 / 1 Checks the basic functionality of the function remove_album Test feedback Incorrect Function Name 12: Unit test ~ 0 / 1 Checks the basic functionality of the function remove_album with an incorrect ID Test feedback Incorrect Function Name 13: Unit test ~ 0/2 Checks the basic functionality of the function favorite_song Test feedback Incorrect Function Name 14: Unit test ~ 0/2 Activate Windows Go to Settings to activate Windows. Checks the basic functionality of the function favorite_song Type here to search O 9 7:43 PM (1 )) 2/25/2021Live Channels You Follow - Twitch X zy Section 8.1 - 1&C SCI 31: Introduc X C learn.zybooks.com/zybook/UCIICSC131Winter2021/chapter/8/section/1?content_resource_id=52191078 ili Apps W Twitch Twitter @ Instagram @ Google YouTube M Gmail f Facebook N Dashboard (_) Canvas Calculus zy Programming - ZyB... Planner T Checkout | Top Hat ? Online Python Com... ICS 31 Style Checker Twice Baked Potato. zyBooks My library > 1&C SCI 31: Introduction to Programming home > 8.1: LAB: ICS Tunes LE zyBooks catalog ? Help/FAQ @ philip moy 15: Unit test ~ 0/ 4 Checks the basic functionality of the function unplayed_songs Test feedback Incorrect Function Name 16: Unit test ~ 0 / 4 Checks the basic functionality of the function unplayed_albums Test feedback Incorrect Function Name 17: Unit test ~ 0/2 Checks the basic functionality of the function favorite_album Test feedback Incorrect Function Name 18: Unit test ~ 0/2 Checks the basic functionality of the function favorite_album Test feedback Incorrect Function Name 19: Unit test ~ 0/2 Test print_menu function Test feedback Incorrect Function Name 20: Compare output 0 / 1 Traceback (most recent call last) : File "main.py", line 3, in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
