Trending Videos

You have been hired as the new Head of IT at Vevo: The leading global music video provider. They have an extensive library of songs, movies, and music videos. However, the data is disorganized, and they need your help to better categorize and manage their content.
The main challenge here is to define a series of classes to categorize their content. Furthermore, they want to know which of their videos are trending. A video is considered trending if it has more than 1 million views in the last 24 hours.
Firstly, create a class Multimedia with an attribute duration and a method play() . Next, define two other classes, Song and Movie, which inherit from Multimedia, each having its unique attributes like artist for Song and director for Movie. Afterward, create a class MusicVideo that inherits from both Song and Movie, adding specific attributes for this class view_count and views_last_24_hours.
You must override the __str__() method in your classes. When an instance of a class is printed, it should display the following:
  1. For MusicVideo: "Music video title: [title], Artist: [artist], Director: [director], Duration: [duration] minutes, Total views: [view_count], Views in last 24 hours: [views_last_24_hours]."
  1. For Song: "Song title: [title], Artist: [artist], Duration: [duration] minutes."
  1. For Movie: "Movie title: [title], Director: [director], Duration: [duration] minutes."
The is_trending() method for MusicVideo should print either:
  1. "[title] by [artist] is trending."
  1. "[title] by [artist] is not trending."
multimedia=Multimedia(3.5); song=Song('Beatles', 'Let It Be', 4); movie=Movie('George Harrison', 'A Hard Days Night', 92); music_video=MusicVideo('Michael Jackson', 'Beat It', 'John Landis', 13.2, 1002000000, 1500000); print(music_video); print(song); print(movie); music_video.is_trending();
Music video title: Beat It, Artist: Michael Jackson, Director: John Landis, Duration: 13.2 minutes, Total views: 1002000000, Views in last 24 hours: 1500000. Song title: Let It Be, Artist: Beatles, Duration: 4 minutes. Movie title: A Hard Days Night, Director: George Harrison, Duration: 92 minutes. Beat It by Michael Jackson is trending. Playing media
Try avoiding the use of super() when dealing with multiple inheritance. Go back to the Multiple Inheritance lesson to revise the proper way of handling the initialization inside the __init__() method for multiple inheritance.


Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue