Python Forum
Recurse through n-dimensional array
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recurse through n-dimensional array
#1
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
Reply
#2
Edit: Want to delete this post, but can't.
Reply
#3
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How convert multidimensional array to two dimensional array tkkhan44 1 2,769 Feb-20-2019, 05:00 AM
Last Post: scidam
  How to add an element such as an average to a multi-dimensional array? xhughesey 6 3,987 Jan-06-2019, 10:47 PM
Last Post: xhughesey
  Three-dimensional Contour Plots minifizikus 1 3,268 Sep-13-2018, 10:56 PM
Last Post: Larz60+
  2 Dimensional NumPy for beginners Jack_Sparrow 2 3,098 May-08-2018, 05:21 PM
Last Post: killerrex
  Two Dimensional Chart from CSV File srini1995 0 2,223 Nov-27-2017, 07:10 AM
Last Post: srini1995
  How to sum elements of same position in n dimensional array Felipe 2 4,120 May-11-2017, 10:33 AM
Last Post: Felipe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020