Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

phyton WHAT TO SUBMIT? This homework assignment asks you to submit only one flle whose name must be playlist. py. This file should contain at

phyton
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
WHAT TO SUBMIT? This homework assignment asks you to submit only one flle whose name must be playlist. py. This file should contain at least seven functions whose desails are given above. Remember that the headers of these functions must be def add_song (playlist, title, year, singer): def, remove_song(playlist, title) it det like_song(playlist, title)t def unlike_song (play1ist, title): def display_all_songs (playlist)i def display_al1_liked_songs(playlist): det show_song(play1ist, title)t Your file may contain other auxilary functions, which might be called frem the aforementioned four functions. However, it SHOULD NOT contain a function whose name is main (). Additionally, thid file SHOULD NOT have amy statements written outside a function definition. We will test your functions writing cur 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 thege function headers. If you modify 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 main () 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 (l.e., the songs with a liked status). The output should be in the following format. If there are noliked songs in the playlist, this function displays - ENPTY IIKED PLAYLIST-= (See the output example of the test program civen beiow to better understand the format.) HIKES Soaves title by ninger natre (for the Ist iked song) title by 8inger name (for the 2 nd hiked song) For this function, you MUST use the following header. In the playliat aceording to the required outpot format. If there exiat. e output exanple of tbe tent progra= given below). def display_al1_1iked_songs (playlist) : Write your code here 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 in this hemework asignment, you are supposed to implement a playliu that contains multiple sorich, in this plaplist, for each sone you will store a fecorit, in which vou keed 1. The wese itie (strinel. 2. The year that the sorg is/was released (ecteger). 3. The name of the sieger (the first and the last name as one stringl, and 4. Whether or not this soog was iked by the user (a Boolean flael. For the sake of wimploaiy, you may ansume that for each song, there in alway one singer. The user will add and deletol wonss from this plovist. Addrionally, the user may like a song at some point bur unlle the same sone iater. Thus, in your inplementation, you Must defint a list to keep information of each song and you MUST define a fiat of liati to krep the entire playlist. That is, you will wese a last of lists (a playliut ef sones where a vone is also represented as a list). Clarificarion. Throughout the reat, we will refer to the first list er a song firt and the list of filts as the ployllst. Your implementation must have at leat the following seven functioes whose details are gren below: 1. Add a song 2. Remove a sane 3. Like a song 4. Unlike a song 5. Divplay all rones in a ciarint 6. Display all skediong in a playlist: 7. Show informaticn abeut a particular song ADD A SONG This function adds a song to the plavist. The sone title, the release year, and the singer's name are specified. on perameters. The liked flug thould be aet to False by drfauit, that is, each song should be considered as not-liked when it in added to the playlist. in the payist, the song tities are unique. They are aho case insencithe, that ic, "leeling good" and "retling goot" should be considered as the same. Thos, if the sser attemoti to add a sone with an aheady exiating titie, the function does not add the sone to the playlit and dieploy a warming message. Otherwise, it perlormis the action. Niols that there might be multiple songs of the ame sirger. TSee the exarple test pregars and its corresponding output gen below to betier yndentand how this functon should work ind the format of the warine metsaep.| for thin function, You Must use the folbwirg header. def add_wedy (pleyilet, titan, year, sisperil

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_2

Step: 3

blur-text-image_3

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

Define interpersonal relations.

Answered: 1 week ago