MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / MultiplyNodeAlt

Class MultiplyNodeAlt

example_code/item_049.py:181–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179 return f"({left_str} + {right_str})"
180
181class MultiplyNodeAlt(NodeAlt):
182 def __init__(self, left, right):
183 self.left = left
184 self.right = right
185
186 def evaluate(self):
187 left = self.left.evaluate()
188 right = self.right.evaluate()
189 return left + right
190
191
192 def pretty(self):
193 left_str = self.left.pretty()
194 right_str = self.right.pretty()
195 return f"({left_str} * {right_str})"
196
197
198print("Example 13")

Callers 1

item_049.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected