Woozy Walk ========== Consider a list of positive :class:`int` (``0`` included). Let's define a "step" from position ``i`` over a list ``L`` (``i`` is in the range of ``L``) as moving to either the position resulting from adding ``L[i]`` to ``i`` if ``L[i]`` is **even**, or the position resulting from substracting ``L[i]`` to ``i`` if ``L[i]`` is **odd**. Write the following function in the module with the same name (file :file:`woozy_walk.py`): .. py:function:: woozy_walk(L, i0) such that **given** - ``L``, :class:`list` of positive :class:`int` (``0`` included) - ``i0`` :class:`int` **returns** a list with all the positions of ``L`` "walked on" by starting at ``i0`` until either it comes to a position through which it have already walked, or it falls outside the positive range of ``L`` (i.e. the interval of **valid positive indexes** of a Python list). For example: .. literalinclude:: woozy_walk.test :language: python3 :start-after: --ini :end-before: --fi Observe the resulting list of the first call: - The first value is 0 because that's the initial position. - The next one is 6 since L[0] is 6 which is even and 0+6 is 6. - The next one is 5 since L[6] is 1 which is odd and 6-1 is 5. - Finally, the next position obtained is 9 since L[5] is 4 which is even and 5+4 is 9. Doctests are available at the file :download:`woozy_walk.test `.