def identity_matrix_elements(n):
  #1 line of code
  return [[( 1 if x == y else 0) for x in range(n)] for y in range(n)]

print('testing for identity_matrix_elements')
print(identity_matrix_elements(4))
assert identity_matrix_elements(4) == [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]
print('Passed')


def counting_across_rows_matrix_elements(m,n):
  return [[(n*y + x + 1) for x in range(n)] for y in range(m)] 

print('testing counting_across_rows_matrix_elements')
print(counting_across_rows_matrix_elements(3,4))
assert counting_across_rows_matrix_elements(3,4) ==[[1,2,3,4],[5,6,7,8],[9,10,11,12]]
print('passed')


d3abe70b7cba8e6a0c99a8a0e21ac78d3d04951e
<mask token>

def identity_matrix_elements(n):
    return [[(1 if x == y else 0) for x in range(n)] for y in range(n)]


<mask token>

def identity_matrix_elements(n):
    return [[(1 if x == y else 0) for x in range(n)] for y in range(n)]


<mask token>


def counting_across_rows_matrix_elements(m, n):
    return [[(n * y + x + 1) for x in range(n)] for y in range(m)]


<mask token>

def identity_matrix_elements(n):
    return [[(1 if x == y else 0) for x in range(n)] for y in range(n)]


print('testing for identity_matrix_elements')
print(identity_matrix_elements(4))
assert identity_matrix_elements(4) == [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1,
    0], [0, 0, 0, 1]]
print('Passed')


def counting_across_rows_matrix_elements(m, n):
    return [[(n * y + x + 1) for x in range(n)] for y in range(m)]


print('testing counting_across_rows_matrix_elements')
print(counting_across_rows_matrix_elements(3, 4))
assert counting_across_rows_matrix_elements(3, 4) == [[1, 2, 3, 4], [5, 6, 
    7, 8], [9, 10, 11, 12]]
print('passed')

def identity_matrix_elements(n):
  #1 line of code
  return [[( 1 if x == y else 0) for x in range(n)] for y in range(n)]

print('testing for identity_matrix_elements')
print(identity_matrix_elements(4))
assert identity_matrix_elements(4) == [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]
print('Passed')


def counting_across_rows_matrix_elements(m,n):
  return [[(n*y + x + 1) for x in range(n)] for y in range(m)] 

print('testing counting_across_rows_matrix_elements')
print(counting_across_rows_matrix_elements(3,4))
assert counting_across_rows_matrix_elements(3,4) ==[[1,2,3,4],[5,6,7,8],[9,10,11,12]]
print('passed')

