PY-15
Build Context and Next-Value Pairs
Task
Write context_next_pairs(values, context_size). context_size is a positive
integer. A context is a list of exactly context_size consecutive values. For
each context that has one following value, return a pair:
(context, next_value)
Read from left to right. Begin with the first complete context, and stop before
any context that would run past the end of values. Do not wrap around and do
not use values from separate ends of the list. Return an empty list when no
full context has a following value. Do not change the input list.
Example
With a context size of 3, the same input produces two pairs: (["a", "b", "c"], "d") and (["b", "c", "d"], "e"). A context equal to or longer
than the input produces no pair.
Your implementation
Edit solution.py and keep this function name and signature:
Return a list whose context items are lists; do not print the result or ask for
input. You may assume that context_size > 0.