Embercode
✕
Stacks and QueuesQuick quiz

Shunting-yard

7 questions. Covers Infix to postfix with the shunting-yard method in Python.

Questions 1 to 5 of 7

  1. 1. What is the postfix form of 3 + 4 * 2?
  2. 2. What does this print, using to_postfix from this lesson? ``python print(to_postfix("12 + 3")) ``
  3. 3. Why does 8 - 3 - 2 become 8 3 - 2 - in postfix?
  4. 4. What does this print, using to_postfix from this lesson? ``python print(to_postfix("8 / 4 / 2")) ``
  5. 5. When an operator arrives, what are the steps in order?

    Use the arrows to put the steps in order.

    1. 1.Pop each operator that binds at least as tightly into the output, stopping at a ( or an empty stack
    2. 2.Read the top of the operator stack
    3. 3.Push the new operator onto the operator stack

4 question(s) left on this page.