Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
class Album: def __init__(self, name, *songs): self.name = name self.songs = list(songs) self.published = False def add_song(self, song): if song.single: return f"Cannot add {song.name}. It's a single" if self.published: return "Cannot add songs. Album is published." if song in self.songs: return f"Song is already in the album." self.songs.append(song) return f"Song {song.name} has been added to the album {self.name}." def remove_song(self, song_name): if self.published: return f"Cannot remove songs. Album is published." for song in self.songs: if song.name = song_name: self.songs.remove(song) return f"Removed song {song.name} from album {self.name}." return f"Song is not in the album." def publish(self): if self.published: return f"Album {self.name} is already published." self.published = True return f"Album {self.name} has been published." def details(self): result += f"Album {self.name}\n" for song in self.songs: result += f'== {song.get_info()}\n' return result.strip()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)