Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Genre:
- def __init__(self, genre):
- self.genre = genre
- def __str__(self):
- return f'{self.genre}'
- class Band:
- def __init__(self, title):
- self.title = title
- def __str__(self):
- return f'{self.title}'
- class Song(Genre, Band):
- def __init__(self, name, genre, title):
- super().__init__(genre)
- self.title = title
- self.name = name
- def get_g(self):
- return self.genre
- def get_t(self):
- return self.title
- def __str__(self):
- return f'{self.name}'
- class Album:
- def __init__(self, album, *name):
- self.album = album
- self.storage = list(name)
- def __len__(self):
- return len(self.storage)
- def __getitem__(self, item):
- return self.storage[item]
- def __str__(self):
- a = [f'{self.storage[i]}' for i in range(len(self.storage))]
- return f'{self.album}:\n' + '\n'.join(a)
- class Subgenre:
- pass
- class Catalog:
- def __init__(self, teg, *catalog):
- self.list = catalog
- self.teg = teg
- def __getitem__(self, item):
- return self.list[item]
- def get_artist(self, other):
- for i in range(len(self.list)):
- if str(self.list[i].get_t()) == str(other):
- print(self.list[i])
- def get_genre(self, other):
- for i in range(len(self.list)):
- if str(self.list[i].get_g()) == str(other):
- print(self.list[i])
- def __str__(self):
- a = [f'{self.list[i]}' for i in range(len(self.list))]
- return f'{self.teg} -> \n' + ',\n'.join(a)
- pop = Genre('pop')
- rammstein = Band('rammstein')
- beatles = Band('beatles')
- L = Band('L')
- rok = Genre('rok')
- rap = Genre('rap')
- song, song2, song3 = Song('Senschut', rok, rammstein), Song('Circles', rap, L), Song('Rammstein', rok, rammstein)
- s, s2, s3 = Song('Yesterday', rok, beatles), Song('Yellow Submarine', rok, beatles), Song('Ultimate', rap, L)
- nice = Album('nice', song, song2)
- good = Album('good', s, s2)
- catalog = Catalog('GoodTaste', song, song2, song3, s3, s, s2)
- print(catalog)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement