Question: ```
lista = [["a", "b", "c"], ["d", "e", "f"]]

def check(temp_plan):
    if all(isinstance(elements, str) for elements  in temp_plan):
        return True
    else:
        return False

print(check(lista))

```

I know the code above returns false since the elements in the list are lists.

Answer: 
You are iterating the array `["a", "b", "c"]`, so `False` is no doubt the result when type-check with `str`

One solution is to flatten the n-dimensional array to 1-dimensional one and then check it (in the example I flatten the array using [`itertools.chain`](https://docs.python.org/3.8/library/itertools.html#itertools.chain))

```
import itertools

lista = [["a", "b", "c"], ["d", "e", "f"]]
listb = [[1, "b", "c"], ["d", "e", "f"]]

def check(temp_plan):
    if all(isinstance(elements, str) for elements in itertools.chain(*temp_plan)):
        return True
    else:
        return False

print(check(lista))
print(check(listb))

```
You can use nested [list comprehensions](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) with `isinstance()` and `any()`:

```
>>> some_list = [["a", "b", "c"], ["d", 5, "f"]]
>>> [any([isinstance(y, int) for y in x]) for x in some_list]
[False, True]

```

If you want to be more stringent, you can use `all()`:

```
>>> another_list = [["a", "b", "c"], [1, 2, 3]]
>>> [all([isinstance(x, int) for x in y]) for y in another_list]
[False, True]

```

If you want to test all sublists, use `all()` again:

```
>>> all([all([isinstance(x, int) for x in y]) for y in another_list])
False

```

To turn that into a function:

```
def check(l):
  return all([all([isinstance(x, int) for x in y]) for y in l])

```