LLD - Behavioral Design Patterns — Part 2
Analyze the following code snippet implementing the Interpreter pattern:
class TerminalExpression:
def __init__(self, symbol):
self.symbol = symbol
def interpret(self, context):
return self.symbol == context
expr = TerminalExpression('Z')
print(expr.interpret())What is the error in this code?