I have a list
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
I want to create a sublist w
from L
of fixed size length 4 . Start and stop are w
are randomly chosen. Valid W
are shown below
[1,2,3,4]
[6,7,8,9]
[3,4,5,6]
[2,3,4,5]
etc.
(1) sublist is made on continuous elements of L
(2) Sublist is always fixed size.
(3) Sublist is made from elements from L
how this can be done in neat pythonic way ?