Hi,
can you help me to understand where I'm wrong in coding?
can you help me to understand where I'm wrong in coding?
a = [] # define first array (future matrix) arr = [] # define a second array(matrix too) while True: text = input() if text == 'end': # if typed end, then create matrix from inputed numbers break a.append([int(j) for j in text.split()]) # fullfill the matrix for i in range(len(a)): for k in range(len(a[i])): arr[i][k]= a[i][k+1] + a[i][k-1] + a[i+1][k] + a[i-1][k] # create new matrix as a sum of all nearby numbers k += 1 i += 1 print(arr)