Predict the value of grid after this code runs: grid = [[0]*3]*2, then grid[0][1] = 5. What does grid equal afterwards?
Pick an answer to check
Exam season is here.Good luck with your papers. Premium for a month: every worked solution, every Test yourself card and 5 mock exams a week, S$15 paid once.
Get Premium for a monthUploaded by dontsueme · 10 December 2024
Lesson 82 Dimensional Array – Nested Lists
A table with 4 rows and 4 columns
Representing . . . A table with 4 rows and 4 columns25518518502559618518525501859625518518596We can represent a table with n rows and m columns into a n by m matrix.25518525596185018518525502551851859618596n rows (horizontal)by m columns (vertical)
A Matrix to a 2 dimensional array[[255,185,185,0], [255,96,185,185], [255,0,185,96], [255,185,185,96]]Nested lists in Python: a list in a list 25518525596185018518525502551851859618596
Lesson Objective•manipulate two dimensional array : nested lists•using matrix as example
Notation of Matrix
Operations and Methods to Matrices•print•finding maximum•addition , subtraction•scalar multiplication•transpose•matrix multiplication (if possible)
creating a null matrix : matrix with all 0creating a m row by n column null matrix •if m = n, the matrix will be square•a matrix need not be square this does not work. Why?so how?
printing a matrixprinting a matrix row by row:
Content continues in the PDF. Download PDF
Predict the value of grid after this code runs: grid = [[0]*3]*2, then grid[0][1] = 5. What does grid equal afterwards?
Pick an answer to check
Pick an answer to check
8 more cards are locked. Premium unlocks them.
8 more cards
Predict the value of grid after this code runs: grid = , then grid[0][1] = 5. What does grid equal afterwards?