Created
May 2, 2023 16:38
-
-
Save TanjimReza/3db4917c33cf3e2ab16b8a92c1cfa5d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Netflix: | |
no_of_shows = 0 | |
shows = [] | |
def __init__(self, name, genre, episodes=10): | |
self.name = name | |
self.genre = genre | |
self.episodes = episodes | |
Netflix.no_of_shows += 1 | |
Netflix.shows.append(self.name) | |
def __str__(self): | |
result = f"Show name: {self.name}\nEpisodes: {self.episodes}\nGenre: {', '.join(self.genre)}" | |
return result | |
def printDetails(): | |
print(f"Total number of shows: {Netflix.no_of_shows}") | |
print('\n'.join(Netflix.shows)) | |
s1 = Netflix("Wednesday",["Mystery","Supernatural"],15) | |
print("==========1==========") | |
print(s1) | |
s2 = Netflix("Dark",["Mind-Bending","Sci-fi"]) | |
print("==========2==========") | |
print(s2) | |
print("==========3==========") | |
Netflix.printDetails() | |
s3 = Netflix("Suits",["Comedy","Courtroom"],20) | |
print("==========4==========") | |
print(s3) | |
s4 = Netflix("Demon Slayer",["Anime"],22) | |
print("==========5==========") | |
print(s4) | |
print("==========6==========") | |
Netflix.printDetails() | |
""" | |
==========1========== | |
Show name: Wednesday | |
Episodes: 15 | |
Genre: Mystery, Supernatural | |
==========2========== | |
Show name: Dark | |
Episodes: 10 | |
Genre: Mind-Bending, Sci-fi | |
==========3========== | |
Total number of shows: 2 | |
Wednesday | |
Dark | |
==========4========== | |
Show name: Suits | |
Episodes: 20 | |
Genre: Comedy, Courtroom | |
==========5========== | |
Show name: Demon Slayer | |
Episodes: 22 | |
Genre: Anime | |
==========6========== | |
Total number of shows: 4 | |
Wednesday | |
Dark | |
Suits | |
Demon Slayer | |
""" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment