Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Identity-matrix/Python/identity-matrix-1.py
Normal file
11
Task/Identity-matrix/Python/identity-matrix-1.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
def identity(size):
|
||||
matrix = [[0]*size for i in range(size)]
|
||||
#matrix = [[0] * size] * size #Has a flaw. See http://stackoverflow.com/questions/240178/unexpected-feature-in-a-python-list-of-lists
|
||||
|
||||
for i in range(size):
|
||||
matrix[i][i] = 1
|
||||
|
||||
for rows in matrix:
|
||||
for elements in rows:
|
||||
print elements,
|
||||
print ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue