Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Band:
- def __init__(self, name):
- self.name = name
- self.albums = []
- def add_album(self, album):
- if album in self.albums:
- return f"Band {self.name} already has {album.name} in their library."
- self.albums.append(album):
- return f"Band {self.name} has added their newest album {album.name}."
- def remove_album(self, album_name):
- for album in self.albums:
- if album.name == album_name:
- if self.published
- return "Album has been published. It cannot be removed."
- self.albums.remove(album)
- return f"Album {album.name} has been removed."
- return f"Album {album.name} is not found."
- def details(self):
- result += f"Band {self.name}\n"
- for album in self.albums:
- result += album.details() + "\n"
- return result.strip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement