The simplest way i could think of:<br><br>a=["apple","orange","banana"]<br>b = ""<br>for i in range(len(a)):<br> 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 <<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
"Eric Walstad" <<a href="mailto:eric@ericwalstad.com">eric@ericwalstad.com</a>> wrote<br><div class="Ih2E3d"><br>> You could also achieve the same result of concatenating a list of<br>> strings by looping over the list items like so:
<br>><br>> b = ''<br>> for fruit in a:<br>> b += fruit<br>><br>> 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 = "%s%s%s" % tuple(a)<br><br>Or for an indefinite number of strings:<br><br>b = "%s" * 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 - <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>