fork download
  1. # your code goes here
  2. arr = [1,2,3,4,5,6,7,8,9,10]
  3. arr2 = []
  4. x=0
  5. while x < len(arr):
  6. arr2.append([arr[x], arr[x+1]])
  7. x+=2
  8. print(arr2)
Success #stdin #stdout 0.03s 9296KB
stdin
Standard input is empty
stdout
[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]