Example results

Some examples of what processData should return for various inputs, using the EXAMPLE and DATA variables shown above.

In [ ]: processData([{'name': 'Two', 'order': 2}, {'name': 'One', 'order': 1}], 1)

Out [ ]: ['One']

In [ ]: processData([{'name': 'Two', 'order': 2}, {'name': 'One', 'order': 1}], 2)

Out [ ]: ['One', 'Two']

In [ ]: processData([{'name': 'Two', 'order': 2}, {'name': 'One', 'order': 1}], 3)

Out [ ]: ['One', 'Two']

In [ ]: processData(
 [{'name': 'A', 'order': 3},
  {'name': 'B', 'order': 2},
  {'name': 'C', 'order': 3},
  {'name': 'D', 'order': 1},
  {'name': 'E', 'order': 4}],
 3
)

Out [ ]: ['D', 'B', 'A']