Given a list, the task is to write a Python program to convert it into a custom overlapping nested list based on element size and overlap step.
Input: test_list = [3, 5, 6, 7, 3, 9, 1, 10], step, size = 2, 4
Output: [[3, 5, 6, 7], [6, 7, 3, 9], [3, 9, 1, 10], [1, 10]]
Explanation: Rows sliced for size 4, and overcoming started after 2 elements of current row.
Input: test_list = [3, 5, 6, 7, 3, 9, 1, 10], step, size = 2, 3
Output: [[3, 5, 6], [6, 7, 3], [3, 9, 1], [1, 10]]
Explanation: Rows sliced for size 3, and overcoming started after 2 elements of current row.
In this, row size is managed by slicing operation and overlap step is managed by step mentioned in range() while using a loop for iteration.
The original list is : [3, 5, 6, 7, 3, 9, 1, 10]
The created Matrix : [[3, 5, 6, 7], [6, 7, 3, 9], [3, 9, 1, 10], [1, 10]]
In this, similar functionality as the above method is used with a variation of having shorthand using list comprehension.
The original list is : [3, 5, 6, 7, 3, 9, 1, 10]
The created Matrix : [[3, 5, 6, 7], [6, 7, 3, 9], [3, 9, 1, 10], [1, 10]]