Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

py list 3d

import pprint    # importing pretty printed
  
def ThreeD(a, b, c):
    lst = [[ ['#' for values in range(a)] for col in range(b)] for row in range(c)]
    return lst
      
values= 5
col = 3
row = 2
# used the pretty printed function
pprint.pprint(ThreeD(values, col, row))

""" OUTPUT
[[['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#']],
 [['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#']]]
  """
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #py #list
ADD COMMENT
Topic
Name
8+2 =