Answers for "python iterate two dimensional array"

0

iterating over 2d array python

x = [ ['0,0', '0,1'], ['1,0', '1,1'], ['2,0', '2,1'] ]
for i in range(len(x)):
  for j in range(len(x[i])):
    print(x[i][j])
Posted by: Guest on June-01-2021
1

loop over twodimensional array python

array = [
  [2, 4, 5, 6],
  [6, 5, 99],
  [849, 33, 7, 7]
]

for i in array:
	for j in i:
      	print(j, end=", ")
        
# 2, 4, 5, 6, 6, 5, 99, 849, 33, 7, 7,
Posted by: Guest on March-18-2021
5

create a 2d array in python

def build_matrix(rows, cols):
    matrix = []

    for r in range(0, rows):
        matrix.append([0 for c in range(0, cols)])

    return matrix

if __name__ == '__main__':
    build_matrix(6, 10)
Posted by: Guest on February-27-2020

Code answers related to "python iterate two dimensional array"

Python Answers by Framework

Browse Popular Code Answers by Language