Python, Programming, Data Science, Artificial Intelligence, Data.
ConcreteObserverB(Observer): def update(self, subject): if subject.state == 0 or subject.state >= 2: print("ConcreteObserverB: Reacted to the event") subject = ConcreteSubject(0) observer_a = ConcreteObserverA() subject.attach(observer_a) observer_b = ConcreteObserverB() subject.attach(observer_b)