Python Forum
Expression Evaluation Using Stacks
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Expression Evaluation Using Stacks
#4
The interpreter does not know where to find the function evaluate. In line 6 of the posted code (probably line 101 or so in your real code) print(evaluate... needs to be
print(mystack.evaluate(x))
which brings up another issue. Not clear to me from your code what you call evaluate on - what is spaces? Is it supposed to be the input string?

The way you have it, evaluate(mystack) would call evaluate on the entire class object, functions and all. You don't want to do that. Call mystack.evaluate() on the data you want evaluate() to act upon.
Reply


Messages In This Thread
RE: Expression Evaluation Using Stacks - by jefsummers - Apr-15-2020, 11:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ADT related stacks prasanthbab1234 8 3,178 Oct-12-2020, 05:52 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020