Question: playlist = [ ] def display _ menu ( ) : print ( Menu: ) print ( 1 . Add a song
playlist
def displaymenu:
printMenu:
print Add a song"
print Remove a song"
print View playlist"
print Number of songs"
print Most frequently added song"
print Exit"
while True:
displaymenu
choice inputEnter your choice :
if choice :
song inputEnter the name of the song to add:
playlist.appendsong
printfsong has been added to the playlist."
elif choice :
song inputEnter the name of the song to remove:
if song in playlist:
playlist.removesong
printfsong has been removed from the playlist."
else:
printfsong is not in the playlist."
elif choice :
if playlist:
printYour playlist:"
for idx, song in enumerateplaylist:
printfidxsong
else:
printThe playlist is empty."
elif choice :
printfThere are lenplaylist songs in the playlist."
elif choice :
if playlist:
mostfrequent maxsetplaylist keyplaylist.count
count playlist.countmostfrequent
printfThe most frequently added song is mostfrequentadded count times
else:
printThe playlist is empty."
elif choice :
printThank you for using the Music Playlist Manager. Goodbye!"
break
else:
printInvalid choice. Please select a number from to
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
