Instructions for the snippets test task.
This is markdown.
We can link to a rubric item and/or a snippet:
processData
function has to return the correct results.process.py
must work correctly when run with inputs.processData
function.TODO: Highlight rubric items & examples when linking to them; add shiny to rubric links via JS!
Now
\
I'll
\
make
\
these
\
longer
\
so
\
the
\
rubric
\
get
\
pushed
\
down...
EXAMPLE
and DATA
variables
A simple example of what the input data might look like, and the slightly more complex DATA
variable provided in the starter code.
In [ ]:EXAMPLE = [{'name': 'Two', 'order': 2}, {'name': 'One', 'order': 1}]
In [ ]:DATA = [{'name': 'A', 'order': 3}, {'name': 'B', 'order': 2}, {'name': 'C', 'order': 3}, {'name': 'D', 'order': 1}, {'name': 'E', 'order': 4}]
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']
Full output example
An example of what the output should look like when your code is run. Note that the blue text shows what inputs were provided in this example.
In [ ]: %run process.py
A or B? A
D
A or B? B
D, B, A
processData
def
to define processData
sorted
processData
, call sorted
in at least once place.processData
returns the correct result
processData
function is run must match the solution result.process.py
exhibits the correct behavior
process.py
as a whole file, the pattern of printed output based on inputs must match the solution's behavior.