“2D Array Pytho” Kode Jawaban

2D Array Pytho


# Creates a list containing 5 lists, each of 8 items, all set to 0
w, h = 8, 5
Matrix = [[0 for x in range(w)] for y in range(h)] 

Better Bear

Buat array 2D di 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)
McBurd

Array 2d dalam Python

from array import *

T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]
for r in T:
    for c in r:
        print(c,end = " ")
    print()
Defiant Duck

Jawaban yang mirip dengan “2D Array Pytho”

Pertanyaan yang mirip dengan “2D Array Pytho”

Lebih banyak jawaban terkait untuk “2D Array Pytho” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya