fork(2) download
  1. xRange = 4
  2. yRange = 3
  3. baseList = []
  4. values = []
  5. count = 0
  6.  
  7. #make a list of 100 values
  8. for i in range(100):
  9. values.append(i)
  10.  
  11. #add 4 lists to base list
  12. for x in range(xRange):
  13. baseList.append([])
  14. #at this point i have [[], [], [], []]
  15.  
  16. #add 3 values to all 4 lists
  17. for x in range(xRange):
  18. for y in range(yRange):
  19. baseList[x].append(values[count])
  20. count += 1
  21.  
  22. print baseList
  23.  
  24. #the result i'm expecting is:
  25. #[[0,1,2], [3,4,5], [6,7,8], [9,10,11]]
  26.  
Success #stdin #stdout 0.08s 10864KB
stdin
Standard input is empty
stdout
[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]