Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python 3D array

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: #python #array
ADD COMMENT
Topic
Name
5+4 =