Embercode
✕
Stacks and QueuesQuick quiz

Two-stack calculators and string decoding

8 questions. Covers Decode nested strings and simplify paths with a Python list.

Questions 1 to 5 of 8

  1. 1. What does this print, using decode from this lesson? ``python print(decode("2[x3[y]]")) ``
  2. 2. When the decoder reads [, what does it save?
  3. 3. What does this print, using simplify from this lesson? ``python print(simplify("/x//y/../z/.")) ``
  4. 4. What does this print, using evaluate from the calculator lesson? ``python print(evaluate("20 / 3 * 3")) ``
  5. 5. If the .. check in simplify is replaced by this loop, what does simplify return for /a/..bak/b? Assume the empty parts and . are skipped, as in the lesson's simplify. ``python if part.startswith(".."): if stack: stack.pop() else: stack.append(part) ``

5 question(s) left on this page.