Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Your younger sibling has just discovered music from the 1970 's. They have put together a playlist of the same 5 songs repeated again

Python

image text in transcribed

Your younger sibling has just discovered music from the 1970 's. They have put together a playlist of the same 5 songs repeated again and again. Here are the songs: - ABC by The Jackson 5 - Venus by Shocking Blue - Lola by the Kinks - Let It Be by the Beatles - Cecilia by Simon and Garfunkel Here is an example of their playlist: ['Lola', 'Venus', 'Lola', 'Lola', 'Let It Be', 'Lola', 'ABC', 'Cecilia', 'Lola', 'Lola'] You want to make sure that Lola only gets played 3 times, so you want to complete this function that edits the playlist: def cap_song_repetition(playlist: List[str], song: str) sone: "" "Make sure there are no more than 3 occurrences of song in playlist. Select the loop(s) that accomplish this. while playlist. count(song) > 3 : playlist. remove(song) while playlist. count(song) > 3 : playlist. remove(playlist.index(song)) while playlist. count(song) >=3 : playlist. remove(song) while playlist. count(song) > 3 : playlist.pop(song) while playlist. count(song) > 3: playlist.pop(playlist.index(song))

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions