fork download
  1. def identidad(f,c):
  2. E=matNula(f,c)
  3. for i in range(f):
  4. E[i][i]=1
  5. return E
  6.  
  7. def matNula(f,c):
  8. m=[]
  9. for i in range(f):
  10. m.append([0]*c)
  11. return m
  12.  
  13. print(identidad(5,5))
Success #stdin #stdout 0.04s 9580KB
stdin
Standard input is empty
stdout
[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]