[Tutor] Re arrays

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Mon, 2 Apr 2001 14:11:02 -0700 (PDT)


On Mon, 2 Apr 2001, Katharine Stoner wrote:

> What I mean is can you take an array full of some thing and put it
> into another section of an array.
> 
> 1st array J1 J2 J3 J4 J5 
> 
> 2nd array H1 H2 H3 H4 H5 
> 
> Can you put the 2nd array in the 1st array's J1.  I don't mean lists
> either.  Perhaps you would have to write a function maybe to do this?


Can you show us an example of how you'd use this?  (Just to make sure I'm
understanding what's happening.)  There's a way to "squeeze" the second
array into the first:

###
>>> x = ['j1', 'j2', 'j3', 'j4', 'j5']
>>> y = ['h1', 'h2', 'h3', 'h4', 'h5']
>>> x[0:0] = y
>>> x
['h1', 'h2', 'h3', 'h4', 'h5', 'j1', 'j2', 'j3', 'j4', 'j5']
###

but I'm pretty sure that this isn't what you're looking for.  There are so
many ways to "put" something into another, so we might be maddeningly off
the mark for a while.

Hope you find what you're looking for!