How to access an element of a nested list with loop

  list, nested-lists, python

how to access an element of nested list with a loop? like:

a = [20,[22,[3,[21]]]]
               #^^ i want to access this

how to access it with a loop, insead of using

a[1][1][1][1]

any solution on any language is accepted (preferably python)

Source: Python Questions

LEAVE A COMMENT