En Mon, 23 Feb 2009 17:22:16 -0200, Gary Wood escribió:
'''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'])
On Mon, Feb 23, 2009 at 11:22 AM, Gary Wood 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']
On Mon, 2009-02-23 at 19:22 +, Gary Wood 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']
You get None b/c that's what's being returned from your join strings
function. Your function already prints out the result and doesn't
return the joined strings a your usage case expects.
So either return the joined strings from your function and don't print
them inside the function, or vice versa
'''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 it