“2d Array Python3” Code-Antworten

2d Array Python3


# 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

Erstellen Sie ein 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)
McBurd

Python Print 2D -Array als Tabelle

for row in A:
    for val in row:
        print '{:4}'.format(val),
    print
just-saved-you-a-stackoverflow-visit

Ähnliche Antworten wie “2d Array Python3”

Fragen ähnlich wie “2d Array Python3”

Weitere verwandte Antworten zu “2d Array Python3” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen