LLD - Design — Online Shopping Cart
In the following code, what is the main issue that prevents observers from receiving notifications?
class Subject:
def __init__(self):
self.observers = set()
def subscribe(self, observer):
self.observers.add(observer)
def notify(self, message):
for obs in self.observers:
obs.receive(message)
class Observer:
def update(self, message):
print(f"Got: {message}")
subject = Subject()
obs1 = Observer()
subject.subscribe(obs1)
subject.notify("Update")