Question: Please use python and follow doc string # Practice Questions for Files (and dictionaries) Let's say we have files that keep track of a list

Please use python and follow doc string # Practice Questions for Files(and dictionaries) Let's say we have files that keep track of aPlease use python and follow doc string

# Practice Questions for Files (and dictionaries) Let's say we have files that keep track of a list of favourite songs in a file with title, singer and release year listed on one line for each song (see songs.txt as an example of such a file) Complete the functions below which take in filenames of files that are formatted just like songs.txt is. Note: The functions below take in an str filename, not the actual file object. So, remember to open the file before reading it and close it appropriately. def contains_song (title: str, filename: str) -> bool: Return True iff title (the name of a song as a string) is included in the file with of the given filename pass def find favourite artist (filename: str) -> str: Return the name of the artist that occurs most frequently in the song file of the given filename. If there are more than one artists that occur most frequently, just return any of them Note: Feel free to create helper functions for this if you need to. Hint: You may want to use the "sorted" function. pass Title, Singer, Release Year Let it go, Idina Menzel, 2013 Happy, Pharrell Williams, 2013 Airplanes, .., 2010 Eyes Open, Taylor Swift, 2012 Stay with me, Sam Smith, 2014

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!