[
[a,b,c,d],
[e,f,g,h],
[i,j,k,l]
]
For example. g is touching b,c,d,f,h,j,k,l and a is touching e,f,b. I tried a method where I made it a big list and did some trash, but it fell apart, tbh. Here's the code if interested:
import math
big_list = []
x= [
["a", "b", "c", "d", "e", "f"],
["g", "h", "i", "j", "k", "l"],
["m", "n", "o", "p", "q", "r"],
["s", "t", "u", "v", "w", "x"],
["y", "z", "1", "2", "3", "4"]
]
#def find_neighbours(num):
for y in x:
for element in y:
big_list.append(element)
def find_row(element):
columns = len(x)
loc = big_list.index(element)
exact_row = (loc)/columns
return(math.floor(exact_row))
def find_column(element):
row = find_row(element)
exact_column = x[row]
return(exact_column)
print(find_column("x"))
The list can be any size and is not always going to be a square.