anonymous
  • anonymous
Problem set 5 no. 6 The solution for the not trigger is class NotTrigger(Trigger): def __init__(self, trigger) self.t = trigger def evaluate(self, story): return not self.t.evaluate(story) I'm unclear as to how the evaluate method works here, is it calling itself? How exactly does self.t.evaluate(story) work behind the scene to produce the desired trigger?
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
rsmith6559
  • rsmith6559
I suspect that there are two evaluate methods in this program. The first is self.elvaluate, and the other is t.evaluate. self.t names a variable, self.t.evaluate() calls the evaluate method OF the self.t datatype. t.evaluate is recursive, self.evaluate is wrapping t.evaluate (getting it started). The key to this would be: what type of data/object is t?
anonymous
  • anonymous
Hi, Thanks for your response. There are several evaluate methods but those evaluate methods are defined in other classes, for other trigger. In this part there is only one evaluate method. The problem set itself has more context that makes it clearer I guess.
rsmith6559
  • rsmith6559
There is only one evaluate method defined in your code, there's two evaluate methods that will run ( NotTrigger.evaluate calls NotTrigger.t.evaluate, which is recursive ) if NotTrigger.evaluate is called.

Looking for something else?

Not the answer you are looking for? Search for more explanations.