Following two result handoffs

A game's scoring prototype starts with 20 energy points and uses the synchronous Python code below. Find the argument n passed to the second call of debit_cps, in energy points, and the final returned score, in score points. Give both as exact integers with zero decimal places.


Python
def debit_cps(n, k):
    return k(n - 6)

def pipeline_cps(n, k):
    return debit_cps(
        n,
        lambda a: debit_cps(2 * a, lambda b: k(b + 5))
    )

pipeline_cps(20, lambda r: 3 * r)
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Continuation Passing Style Questions: