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 always fixed size.(2) Sublist is made from consecutive elements from L
how this can be done in neat pythonic way ?