Question: Write a python Playlist and Song classes for the test cases. def test_PlaylistSong_classes(): song1 = Song(spotify1, 20) assert((song1.title == spotify1) and (song1.rating == 20)) song2

Write a python Playlist and Song classes for the test cases.

def test_PlaylistSong_classes(): song1 = Song("spotify1", 20) assert((song1.title == "spotify1") and (song1.rating == 20))

song2 = Song("spotify2") assert((song2.title == "spotify2") and (song2.rating == 16))

playlist1 = Playlist([song1, song2]) assert(playlist1.songs == [song1, song2]) assert(playlist1.average_rating() == 18) #average of 20 and 16

playlist2 = Playlist([song1]) assert(playlist2.songs == [song1]) assert(playlist2.average_rating() == 20) #average of 20

playlist2.add_song(song2)# add_song assert(playlist2.songs == [song1, song2]) assert(playlist2.average_rating() == 18) # average of 20 and 16 print("done!")

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!