li = [[1, 2, 3], [4, 5], [6], [7, 8, 9, 10]]

def xlate(li, wanted):
    idx = 0
for i, e in enumerate(li):
    for j, e_ in enumerate(e):
        if idx == wanted:
            return i, j
idx += 1
return None, None
t = xlate(li, 5)
li[t[0]][t[1]] = 'X'
How to replace the nth element of multi dimension lists in Python?