LLD - Design — Online Shopping Cart
Consider this simplified code snippet for a notification system:
class Subject:
def __init__(self):
self.observers = []
def subscribe(self, observer):
self.observers.append(observer)
def notify(self, message):
for obs in self.observers:
obs.update(message)
class Observer:
def update(self, message):
print(f"Received: {message}")
subject = Subject()
obs1 = Observer()
subject.subscribe(obs1)
subject.notify("State changed")
What will be the output when subject.notify("State changed") is called?