L
L
lumpenkoder2020-05-19 13:41:33
Python
lumpenkoder, 2020-05-19 13:41:33

Creating and populating a 2D array with elements of an existing array?

i have array [1,2,3,4,5,6,7,8,9] and i want to get

how to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-05-19
@lumpencoder

a = [1,2,3,4,5,6,7,8,9]
[a[i*3:i*3+3] for i in range(len(a)//3)]


Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question