![]() |
Recurse through n-dimensional array - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Recurse through n-dimensional array (/thread-9171.html) |
Recurse through n-dimensional array - ColdDeath - Mar-24-2018 Hi all, I'm learning the basics of Python (and programming). I'm aware that Numpy exists and I eventually will (have to) use it, but I don't want to right now. Case: I have a 3 x 3 x 3 array. I have 27 complex arrays generated, however for purpose sake: a1=[1], a2=[2] ... a26=[26], a27=[27]. I want to insert these 27 arrays so that array[0][0][0]=a1 array[0][0][1]=a2 . . . array[2][2][1]=a26 array[2][2][2]=a27 I know how to do this with iteration, but I want to explore and do this via recursion. So 2 questions: 1. How do I solve this case with recursion? 2. How do I limit the number of recursion within recursions when using bigger dimensional arrays? So that PyCharm doesn't crash. Thank you, ColdDeath RE: Recurse through n-dimensional array - ColdDeath - Apr-04-2018 Edit: Want to delete this post, but can't. RE: Recurse through n-dimensional array - KenniT - Apr-05-2018 (Apr-04-2018, 06:14 PM)ColdDeath Wrote: Edit: Want to delete this post, but can't. You can't delete your own posts on this forum :P |