On Mon, Feb 23, 2009 at 11:22 AM, Gary Wood <woody...@sky.com> wrote: > '''exercise to complete and test this function''' > import string > def joinStrings(items): > '''Join all the strings in stringList into one string, > and return the result. For example: > >>> print joinStrings(['very', 'hot', 'day']) > 'veryhotday' > ''' > word = [items] > for item in items: > print (item, end='') > > > def main(): > print(joinStrings(['very', 'hot','day'])) > print(joinStrings(['this', 'is','it'])) > print(joinStrings(['1', '2', '3', '4', '5'])) > > main()
Reiterating myself from your previous thread which this is a duplicate of: You're not supposed to *output* the strings in joinStrings() [i.e. don't use print()!], you've supposed to *combine* them and *return* the single combined string (it's nearly identical to how you summed the numbers in the earlier exercise). The actual outputting of the combined string is done by the calls to print() *outside* of joinStrings(), in main(). Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list