Question: In this homework assignment, you are supposed to implement a playlist that contains multiple songs. In this playlist, for each song, you will store a

 In this homework assignment, you are supposed to implement a playlist
that contains multiple songs. In this playlist, for each song, you will
store a record, in which you keep 1. The song title (string),
2. The year that the song is/was released (integer), 3. The name
of the singer (the first and the last name as one string),
and 4. Whether or not this song was liked by the user

In this homework assignment, you are supposed to implement a playlist that contains multiple songs. In this playlist, for each song, you will store a record, in which you keep 1. The song title (string), 2. The year that the song is/was released (integer), 3. The name of the singer (the first and the last name as one string), and 4. Whether or not this song was liked by the user (a Boolean flag). For the sake of simplicity, you may assume that for each song, there is always one singer. The user will add and delete songs from this playlist. Additionally, the user may like a song at some point but unlike the same song later. Thus, in your implementation, you MUST define a list to keep information of each song and you MUST define a list of lists to keep the entire playlist. That is, you will use a list of lists (a playlist of songs where a song is also represented as a list). Clarification: Throughout the text, we will refer to the first list as a song list and the list of lists as the playlist. Your implementation must have at least the following seven functions whose details are given below: 1. Add a song 2. Remove a song 3. Like a song 4. Unlike a song 5. Display all songs in a playlist 6. Display all liked songs in a playlist 7. Show information about a particular song ADD A SONG This function adds a song to the playlist. The song title, the release year, and the singer's name are specified as parameters. The liked flag should be set to False by default; that is, each song should be considered as not-liked when it is added to the playlist. In this playlist, the song titles are unique. They are also case insensitive; that is, "feeling good" and "FEElinG gooD" should be considered as the same. Thus, if the user attempts to add a song with an already existing title, the function does not add the song to the playlist and displays a warning message. Otherwise, it performs the action. Note that there might be multiple songs of the same singer. (See the example test program and its corresponding output given below to better understand how this function should work and the format of the warning message.) For this function, you MUST use the following header. \# This function takes a list of songs together with the title, the release year, \# and the singer's name of the song to be added. The liked flag should be set to \# False by default. If the song title does not exist in the playlist, the function \# adds a song list, which keeps the information about the song, to the end of \# the playlist. Otherwise, if the song title already exists in the playlist, the \# function does not add any song list to the playlist and displays a warning \# message (for the message format, see the output example of the test program \# given below). You may assume that the function arguments are always valid. * That is, the title and the singer's name are always strings, and the release \# year is always a positive integer. def add_song (playlist, title, year, singer): \# Write your code here REMOVE A SONG This function removes a song from the playlist. The song title is specified as a parameter. If there is no song with the specified title, the function does not remove any song from the playlist and displays a warning message. Otherwise, it performs the action. (See the example test program and its corresponding output given below to better understand how this function should work and the format of the warning message.) For this function, you MUST use the following header. \# This function takes a list of songs (playlist) together with the title of a \# song to be removed. If the song title exists in the playlist, the function \# removes the corresponding song list from the playlist. Otherwise, if the song \# title does not exist in the playlist, the function does not remove any song \# from the playlist and displays a warning message (for the message format, see \# the output example of the test program given below). You may assume that the \# song title argument is always a string. Remember that all song titles are \# unique and case insensitive. def remove_song(playlist, title): \# Write your code here \# . . LIKE A SONG This function is to like a song from the playlist. The song title is specified as a parameter. If there is no song with the specified title, the function does not like any song from the playlist and displays a warning message. Otherwise, it performs the action. Note that if the corresponding song has already been liked, this function will not change the like status of the song. (See the example test program and its corresponding output given below to better understand how this function should work and the format of the warning message.) For this function, you MUST use the following header. \# This function takes a list of songs (playlist) together with the title of a \# song to be liked. If the song title exists in the playlist, the function \# likes the corresponding song list in the playlist. Otherwise, if the song \# title does not exist in the playlist, the function does not like any song \# in the playlist and displays a warning message (for the message format, see \# the output example of the test program given below). You may assume that the \# song title argument is always a string. Remember that all song titles are \# unique and case insensitive. def like_song (playlist, title): \# Write your code here \# ... UNLIKE A SONG This function is to unlike a song from the playlist. The song title is specified as a parameter. If there is no song with the specified title, the function does not like any song from the playlist and displays a warning message. Otherwise, it performs the action. Note that if the corresponding song has not been liked, this function will not change the like status of the song (i.e., its status should remain as unliked). (See the example test program and its corresponding output given below to better understand how this function should work and the format of the warning message.) For this function, you MUST use the following header. \# This function takes a list of songs (playlist) together with the title of a \# song to be unliked. If the song title exists in the playlist, the function \# unlikes the corresponding song list in the playlist. Otherwise, if the song \# title does not exist in the playlist, the function does not unlike any song \# in the playlist and displays a warning message (for the message format, see \# the output example of the test program given below). You may assume that the \# song title argument is always a string. Remember that al1 song titles are \# unique and case insensitive. def unlike_song (playlist, title): \# Write your code here DISPLAY ALL SONGS This function lists all songs already found in the playlist. The output should be in the following format. If there are no songs in the playlist, this function displays --EMPTY PLAYLIST-- (See the output example of the test program given below to better understand the format.) For this function, you MUST use the following header. \# This function takes a list of songs (playlist) and displays all song lists \# found in the playlist according to the required output format. If there exist \# no songs in the playlist, this function displays -_EMPTY-- (see the output \# example of the test program given below). def display_all_songs (playlist): \# Write your code here \# . . DISPLAY ALL LIKED SONGS This function lists the songs in the playlist, which are currently liked by the user (i.e., the songs with a liked status). The output should be in the following format. If there are no liked songs in the playlist, this function displays --EMPTY LIKED PLAYLIST-- (See the output example of the test program given below to better understand the format.) LIKEDSONGStitlebysingernametitlebysingername(forthe1stlikedsong)(forthe2ndlikedsong) For this function, you MUST use the following header. \# This function takes a list of songs (playlist) and displays all liked songs \# in the playlist according to the required output format. If there exist \# no liked songs in the playlist, this function displays - EMPTY-- (see the \# output example of the test program given below). def display_al1_liked_songs (playlist): \# Write your code here \# ... SHOW A SONG This function displays all information about a song whose title is specified as a parameter. The output should be in the following format. If the song with the specified title does not exist in the playlist, the function displays a warning message. (See the example test program and its corresponding output given below to better understand how this function should work and the format of the warning message.) Title of the song + if it is a liked song> Released in Performed by singer's name For this function, you MUST use the following header. (1) This function takes a playlist together with the title of a song whose \# Information will be showed. If the song title exists in the playlist, \# the function displays the information stored in the corresponding song 1ist * according to the required output format. If the title does not exist in the * playlist, 1t displays a warning message (for the message format, see the output \# example of the test program given below). You may assume that the song titie * argument is always a string def show_song (playlist, title): Write your code here WHAT TO SUBMIT? This homework assignment asks you to submit only one file whose name must be playlist. py. This file should contain at least seven functions whose details are given above. Remember that the headers of these functions must be def add_song(playlist, title, year, singer): def remove_song(playlist, title): def like_song(playlist, title): def unlike_song(playlist, title): def display_all_songs (playlist): def display_all_liked_songs(playlist): def show_song(playlist, title): Your file may contain other auxiliary functions, which might be called from the aforementioned four functions. However, it SHOULD NOT contain a function whose name is main (). Additionally, this file SHOULD NOT have any statements written outside a function definition. We will test your functions writing our own main function, similar to the one given below, and calling this main function to start the program. **IMPORTANT: You MUST use the given function headers as they are. We will use these headers to call your functions and test them. You are NOT allowed to modify these function

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 Databases Questions!