Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you write the codes please i need it for today i don't know anything just write what to code in spyder ADD A SONG

can you write the codes please i need it for today i don't know anything just write what to code in spyder
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
ADD A SONG This function adds a song to the playlist. The song title, the relexse year, and the singer's name are spectied as porameters. 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 tities are unique. They are abso case inseesitive; that is, Teeling good" and "FEFInG gooD* should be considered as the same. Thus, if the user attempts to add a song with an already exiating title, the function does not add the song to the playlist and displays a warning mesuge Oeherwise, it performs the action. Nate that there might be multiple songs of the same singer. (5ee the example test program and its correspondine output given below to better undentand how this function should work and the format of the warning mestage) For this function, you MUST use the following header. A This function takes a list of songs copether with the titile, the relesal year, * and the ainger'n pane of the angg to bir added. Thir Liked fiag should be net to V Valse ly defavlt. If the soep citle doen not exiat in the playlint, the fuection oddi a hiong list, which Keeps the inforeation aboat the song, to the end of the ploylint. Otherkdie, if the sosy titie already ninte in the playliet, the f fuoction doen not add any wony - 1ilit to the playliet nod displeys a varning A nebenge (for tbe neaaage fornati, liee the outpot equple of the teac prouran A yyun belowy. Tod may annuase tbot tbe tanction arqunent a are alwaye palfu. C. yoar in alvay a panieste integer. def add_nong(playlist, title, Year, singer) : 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 Boclean flagk). 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). Ciorificotian: 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 laked songs in a playlist 7. Show information about a particular song: WHAT TO SUBMIT? This homework assignment asks you to submit only one file whose name most be playlist. Py. This file should contain at least seven functions whose detaits are given above. Remember that the headers of these functions must be Your file may contain other auxiliary functiens, which might be called from the aforementioned four functions. However, it SHOULD NOT contain a function whose name is main (). Additionally, this flle SHOULD NOT have amy 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 headers. If you modity them, you will get no points from the corresponding part since we cannot call your functions properly, and thus, we cannot test and grade them, Additionally, if your file contains a function called ma in () or if it has a statement outside any function definition, you may lose a considerable number of points. Note that although you will not submit a main function, you should, of course, write a main 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 mestage. TSee the example test program and its corresponding output even below to better understand how this function should work and the format of the warning message.) Title of the song oput + if it is a 11ked song? Releared in 4 release year Performed by cainger's names for this function, you MUsT use the following header. A Thin funotion takni a playilat together with tbe tiele of a somp whose t iritornation will be aboved. If the noeg tifte exiate in the playlint, * the function dieplaya the Infomation atored in the eorrmapanding nobg. Hat A nccording to the required cetput format. If the titile does not waint in the f playlist, it dieplays a waraing neusage. (for the necaage format, nee che outgut F oxanple of the teat progran given belov). Xed may assuae that the song tifie 5. arguentent In alwaya 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 playli st. py. This fle should contain at least seven functions whose detalls are given above. Femember that the headers of these functions must be DISPLAY ALL LIKED SONGS This function lists the songs in the playlist, which are currently liked by the user fue,, the songs with a status). The cutput should be in the following format if there are no liked songs in the playlist, this func displays - EMPTY LIKED PLAYLIST-- (See the output example of the test program given below to better understand the format.). LIKED SONES title by singer name (for the 1st liked song) title by singer namo Ufor the 2nd irked song). For this function, you MUSI use the following header. O This function takes a list of nongs (playliat) and dipplayk all 1iled nonay to in the playliut according to the required outpat format. If there axist. f no liked wongs in the playliat, thif funetion diuplaya - Darr- (see the (4 output example of the tent progran given below). def display_al1_1 iked_songs (playlist) : DISPLAY ALLSONGS This function lists all songr already found in the playlist. The output should be in the following format. If there are no songs in the playlat, this function displays EETYY PLAYIISY-- (See the output example of the test progran given below to better understand the format.) For this function, you MUST use the following header. A tound in the playifat accardiag to the required output tormat. If there eniat. f no ponge in the playliat, this fubetion dinplaya - DUPrY- (see the output 8 example of the test progran ytven below). def display_al1_songs (playlist )1 DISPLAY ALL LIKED SONGS This function lists the songs in the playlist, which are currently liked by the user fle, the songs with a liked status) The output should be in the following format. If there are no liked songs in the playist, this function displays--EMVTY LIKED PLAYLIST-- (See the output example of the test program given below to better understand the format.) LIKED SOBGS Eltle by singer name (for the ist liked song) title by Hinger name (Jar the Znd uked sang) UNLIKE A SONG This function is to unike a song from the plaplist. The song title is specilied as a parameter. If there is no song with the specified title, the function does not like any sone from the ploylit and displays a waening mersage. Otherwive, if performs the action. Note that if the corresponding song has not bech lied, this function will not change the like status of the sone Q.e. Its stacus should remain as unikedf. (5ee the example test program and its corresponsing output gwen below to better understand how thus: function should work and the format of the warning message) For this furction, you Must use the foliowing header. f gnlikes the cotreepending noeg Mat in the playlias. ochervine. it ehe anig f in the playlint and timpling a whrning Bensage (fos the mensage format, ane A sosg tlele apguinent la alvaye a atring, Tenember that all hong tielah afe F unsque ald acke insersitive. def undike song(playlist, title) : the output iframple of the takt progran glven belovi. You nay anntro, that then of antique and canei. Inneasiteive. def renove song (play1kst, title ) z Hitte yout code here LIKE A SONG This function is to like a sone from the plarlist. 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 dispiays a waming message. Otherwise, it performs the action. Note that if the corresponding song has alreacy 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 warnirg message.) For this function, you MuSI use the following header. If Thin function, takes a lint of nongn (playlitt) togetbet with the title of a g vang to be Fiked. If the arong trite pxitet in the playlint, the tunetith of the playliat and diseplays a Marning nedeage i tor the nuanage format. bee. * the ioutput woumple of the itent fropran pives below ) . You fuy aseute that the to unique and rase insensit lve - def like song (play11st, tit1e) t Hritin your eode here REMOVE A SONG This function removes a song from the playlist. The song tisie is specified as a parameser. If there is no song with the specified title, the function does not remove any song from the playlot and displays a warning: message. Otherwise, it performs the action. (See the example test program and its coriesponding output given below to befter understand how this function should work and the format of the warning message.) For this function, you MusT use the following header. A Ihls fahetion takes a liat of sooge (playliut) together vith the tle le of. 8 gong to be renoved. If the song title exiats in the playliat, the function titlo doen not exist in the playlist, thin function doen not senoye any eong froa the playliet and dinplayw a varning nessage (for the nassage format; we the output exanple of the teat frograt given belou). Vou nay aspuat that the A nang title argument la alvays a strieg. Hosmber that all hoeg fitlen are 6 whique and case tanasiftefve. def. renove song(playlist, title) 1 Wirlte 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 doer not ike any seng from the playlist and displays a warning message. Qtherwise, 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. ISee the example test program and is corresponding output given below to better underatand how this ADD A SONG This function adds a song to the playlist. The song title, the relexse year, and the singer's name are spectied as porameters. 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 tities are unique. They are abso case inseesitive; that is, Teeling good" and "FEFInG gooD* should be considered as the same. Thus, if the user attempts to add a song with an already exiating title, the function does not add the song to the playlist and displays a warning mesuge Oeherwise, it performs the action. Nate that there might be multiple songs of the same singer. (5ee the example test program and its correspondine output given below to better undentand how this function should work and the format of the warning mestage) For this function, you MUST use the following header. A This function takes a list of songs copether with the titile, the relesal year, * and the ainger'n pane of the angg to bir added. Thir Liked fiag should be net to V Valse ly defavlt. If the soep citle doen not exiat in the playlint, the fuection oddi a hiong list, which Keeps the inforeation aboat the song, to the end of the ploylint. Otherkdie, if the sosy titie already ninte in the playliet, the f fuoction doen not add any wony - 1ilit to the playliet nod displeys a varning A nebenge (for tbe neaaage fornati, liee the outpot equple of the teac prouran A yyun belowy. Tod may annuase tbot tbe tanction arqunent a are alwaye palfu. C. yoar in alvay a panieste integer. def add_nong(playlist, title, Year, singer) : 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 Boclean flagk). 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). Ciorificotian: 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 laked songs in a playlist 7. Show information about a particular song: WHAT TO SUBMIT? This homework assignment asks you to submit only one file whose name most be playlist. Py. This file should contain at least seven functions whose detaits are given above. Remember that the headers of these functions must be Your file may contain other auxiliary functiens, which might be called from the aforementioned four functions. However, it SHOULD NOT contain a function whose name is main (). Additionally, this flle SHOULD NOT have amy 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 headers. If you modity them, you will get no points from the corresponding part since we cannot call your functions properly, and thus, we cannot test and grade them, Additionally, if your file contains a function called ma in () or if it has a statement outside any function definition, you may lose a considerable number of points. Note that although you will not submit a main function, you should, of course, write a main 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 mestage. TSee the example test program and its corresponding output even below to better understand how this function should work and the format of the warning message.) Title of the song oput + if it is a 11ked song? Releared in 4 release year Performed by cainger's names for this function, you MUsT use the following header. A Thin funotion takni a playilat together with tbe tiele of a somp whose t iritornation will be aboved. If the noeg tifte exiate in the playlint, * the function dieplaya the Infomation atored in the eorrmapanding nobg. Hat A nccording to the required cetput format. If the titile does not waint in the f playlist, it dieplays a waraing neusage. (for the necaage format, nee che outgut F oxanple of the teat progran given belov). Xed may assuae that the song tifie 5. arguentent In alwaya 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 playli st. py. This fle should contain at least seven functions whose detalls are given above. Femember that the headers of these functions must be DISPLAY ALL LIKED SONGS This function lists the songs in the playlist, which are currently liked by the user fue,, the songs with a status). The cutput should be in the following format if there are no liked songs in the playlist, this func displays - EMPTY LIKED PLAYLIST-- (See the output example of the test program given below to better understand the format.). LIKED SONES title by singer name (for the 1st liked song) title by singer namo Ufor the 2nd irked song). For this function, you MUSI use the following header. O This function takes a list of nongs (playliat) and dipplayk all 1iled nonay to in the playliut according to the required outpat format. If there axist. f no liked wongs in the playliat, thif funetion diuplaya - Darr- (see the (4 output example of the tent progran given below). def display_al1_1 iked_songs (playlist) : DISPLAY ALLSONGS This function lists all songr already found in the playlist. The output should be in the following format. If there are no songs in the playlat, this function displays EETYY PLAYIISY-- (See the output example of the test progran given below to better understand the format.) For this function, you MUST use the following header. A tound in the playifat accardiag to the required output tormat. If there eniat. f no ponge in the playliat, this fubetion dinplaya - DUPrY- (see the output 8 example of the test progran ytven below). def display_al1_songs (playlist )1 DISPLAY ALL LIKED SONGS This function lists the songs in the playlist, which are currently liked by the user fle, the songs with a liked status) The output should be in the following format. If there are no liked songs in the playist, this function displays--EMVTY LIKED PLAYLIST-- (See the output example of the test program given below to better understand the format.) LIKED SOBGS Eltle by singer name (for the ist liked song) title by Hinger name (Jar the Znd uked sang) UNLIKE A SONG This function is to unike a song from the plaplist. The song title is specilied as a parameter. If there is no song with the specified title, the function does not like any sone from the ploylit and displays a waening mersage. Otherwive, if performs the action. Note that if the corresponding song has not bech lied, this function will not change the like status of the sone Q.e. Its stacus should remain as unikedf. (5ee the example test program and its corresponsing output gwen below to better understand how thus: function should work and the format of the warning message) For this furction, you Must use the foliowing header. f gnlikes the cotreepending noeg Mat in the playlias. ochervine. it ehe anig f in the playlint and timpling a whrning Bensage (fos the mensage format, ane A sosg tlele apguinent la alvaye a atring, Tenember that all hong tielah afe F unsque ald acke insersitive. def undike song(playlist, title) : the output iframple of the takt progran glven belovi. You nay anntro, that then of antique and canei. Inneasiteive. def renove song (play1kst, title ) z Hitte yout code here LIKE A SONG This function is to like a sone from the plarlist. 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 dispiays a waming message. Otherwise, it performs the action. Note that if the corresponding song has alreacy 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 warnirg message.) For this function, you MuSI use the following header. If Thin function, takes a lint of nongn (playlitt) togetbet with the title of a g vang to be Fiked. If the arong trite pxitet in the playlint, the tunetith of the playliat and diseplays a Marning nedeage i tor the nuanage format. bee. * the ioutput woumple of the itent fropran pives below ) . You fuy aseute that the to unique and rase insensit lve - def like song (play11st, tit1e) t Hritin your eode here REMOVE A SONG This function removes a song from the playlist. The song tisie is specified as a parameser. If there is no song with the specified title, the function does not remove any song from the playlot and displays a warning: message. Otherwise, it performs the action. (See the example test program and its coriesponding output given below to befter understand how this function should work and the format of the warning message.) For this function, you MusT use the following header. A Ihls fahetion takes a liat of sooge (playliut) together vith the tle le of. 8 gong to be renoved. If the song title exiats in the playliat, the function titlo doen not exist in the playlist, thin function doen not senoye any eong froa the playliet and dinplayw a varning nessage (for the nassage format; we the output exanple of the teat frograt given belou). Vou nay aspuat that the A nang title argument la alvays a strieg. Hosmber that all hoeg fitlen are 6 whique and case tanasiftefve. def. renove song(playlist, title) 1 Wirlte 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 doer not ike any seng from the playlist and displays a warning message. Qtherwise, 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. ISee the example test program and is corresponding output given below to better underatand how this

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

What advice would you provide to Jennifer?

Answered: 1 week ago

Question

What are the issues of concern for each of the affected parties?

Answered: 1 week ago