The simplest way i could think of:<br><br>a=[&quot;apple&quot;,&quot;orange&quot;,&quot;banana&quot;]<br>b = &quot;&quot;<br>for i in range(len(a)):<br>&nbsp;&nbsp;&nbsp;&nbsp; b += a[i]<br>print b<br><br><br>Amit<br><br><div class="gmail_quote">
On Dec 10, 2007 6:48 AM, Alan Gauld &lt;<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&quot;Eric Walstad&quot; &lt;<a href="mailto:eric@ericwalstad.com">eric@ericwalstad.com</a>&gt; wrote<br><div class="Ih2E3d"><br>&gt; You could also achieve the same result of concatenating a list of<br>&gt; strings by looping over the list items like so:
<br>&gt;<br>&gt; b = &#39;&#39;<br>&gt; for fruit in a:<br>&gt; &nbsp; &nbsp;b += fruit<br>&gt;<br>&gt; print b<br><br></div>And to add to the options you could use the formatting operator<br>provided you know there are only 3 items,
<br><br>b = &quot;%s%s%s&quot; % tuple(a)<br><br>Or for an indefinite number of strings:<br><br>b = &quot;%s&quot; * len(a)<br>b = b % tuple(a)<br><br>So many options. However, to the OP, if you get stuck in<br>future its best if you post the erroneous code that you have tried,
<br>then we can better see where you have gone wrong and thus<br>provide clearer guidance on how to fix it. Its better to learn to<br>do it your own way correctly than just to see other folks<br>attempts .<br><br>HTH,<br>
<font color="#888888"><br>--<br>Alan Gauld<br>Author of the Learn to Program web site<br><a href="http://www.freenetpages.co.uk/hp/alan.gauld" target="_blank">http://www.freenetpages.co.uk/hp/alan.gauld</a><br></font><div>
<div></div><div class="Wj3C7c"><br>_______________________________________________<br>Tutor maillist &nbsp;- &nbsp;<a href="mailto:Tutor@python.org">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">
http://mail.python.org/mailman/listinfo/tutor</a><br></div></div></blockquote></div><br><br>