It is necessary to make a two-dimensional list of n * n with numbers that doubled (1,2,4,8,16 and so on) and output that number according to the coordinates entered by the user, I made a list generator, but I can not display.
n=int(input()) s=int(input()) g=int(input()) a = [[0]*n for i in range(n)] counter = 1 for x in range(n): for y in range(n): a[x][y] = counter counter += counter print(a) print(a[s][g]) Input data:
8 2 7 8- field length 2, 7 - coordinates respectively Weekend:
32768 I have the conclusion: 8388608 I understand that the account will be entered from 0, but I can’t think of how to properly deduce
print(a[s-1][g-1])? By the way the correct conclusion should be:16384- MaxU1, and not with0- MaxUprint(a[s-1][g-1])- MaxUrangereturns values from 0 to 7, and you probably represent an array as from 1 to 8, so you correctly return the value 8388608, since in the written code, in your understanding, you output 3 lines, column 8 - Komdosh