<html>
<body>
At 01:39 PM 6/30/2008, Dick Moores wrote:<br>
<blockquote type=cite class=cite cite="">At 11:01 PM 6/29/2008, wesley
chun wrote:<br>
<blockquote type=cite class=cite cite="">&gt; &gt; e.g. can you predict
the result of the following operations without trying it?<br>
&gt; &gt;<br>
&gt; &gt; a = [1, 2, 3, 4]<br>
&gt; &gt; a[1:3] = [7, 8]<br>
&gt; &gt; print a<br>
&gt;<br>
&gt;&nbsp; [1, 7, 8, 4]&nbsp;&nbsp; Whew!<br>
&gt;&nbsp; (I really wasn't positive that it shouldn't be [1, [7, 8], 4]
!)<br><br>
good job dick! of course, you *know* i'm going to ask this...<br>
how *do* you get it to be [1, [7, 8], 4] given the original 'a'?&nbsp;
:-)</blockquote><br>
I had to look at section 5.1 in the Python tutorial, for insert() and
remove(), but didn't try them out. How about<br><br>
<tt>a = [1,2,3,4]<br>
a.remove(2)<br>
a.remove(3)<br>
a.insert(1,[7,8])</tt></blockquote><br>
Hey!<br><br>
&gt;&gt;&gt; a = [1,2,3,4]<br>
&gt;&gt;&gt; a.remove(2)<br>
&gt;&gt;&gt; a.remove(3)<br>
&gt;&gt;&gt; a.insert(1,[7,8])<br>
&gt;&gt;&gt; a<br>
[1, [7, 8], 4]<br>
&gt;&gt;&gt; <br><br>
Show me a better way?<br><br>
Dick<br><br>
</body>
</html>