Responsive Navbar with Google Search
☰ Menu
🏠 Home
Python
📄 LaTeX
📊 GNUPlot
💬 Feedback
✉️ Contact
Matrix Operation: Matrix
Matrix Operation
Matrix
Matrix Addition
Matrix Multiplication
Matrix Transpose
Matrix Determinant
Matrix using List Comprehension
Loading Python Environment…
Python runs in your browser. Heavy or infinite loops may freeze your browser tab. Use "Stop" if needed; for heavy jobs, run locally.
Program 1
Matrix
'''Define 2x2 matrix''' matrix = [ [1, 2], [3, 4] ] print(matrix)
Run
Stop
Output 1
Program 2
Matrix
'''Define 3x3 matrix''' matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] print(matrix)
Run
Stop
Output 2
Program 3
Matrix
'''Accessing Elements in a Matrix''' matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] element = matrix[1][2] # Access element in the 2nd row, 3rd column (zero-indexed) print(element)
Run
Stop
Output 3
Program 4
Matrix
'''Iterate over a matrix''' matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] for row in matrix: for element in row: print(element, end=" ") print()
Run
Stop
Output 4
Program 5
Matrix
'''Modify element in matrix''' matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] matrix[0][1] = 10 # Modify the element in the 1st row, 2nd column print(matrix)
Run
Stop
Output 5