python create n*n matrix
# 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)]
python create n*n matrix
# 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)]
2d array python3
# 5x6, 2-d array of booleans using list comprehension:
matrix = [[False for col in range(6)] for row in range(5)]
# 6x5, 2-d array of banana's using list comprehension:
matrix = [['banana' for col in range(5)] for row in range(6)]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us