I have a list E = [1,2,3,4,5,6,7,8]
and I will like to convert it into E = [{1,2}, {3,4}, {5,6}, {7,8}]
in the least computationally expensive manner. In particular, I will like to extend this to large instances of E
.
Is there an efficient way to do this in Python (3.5 & later)?
Remark: E
will always be given as an even-sized list, as I am working on graphs related topics