No subject

Gary Wood woodygar at sky.com
Thu Feb 19 17:07:01 EST 2009


 I'm stuck on a tutorial Hands on Python3
Exercise 1.13.7.3. ** Complete the following function. This starting code is in joinAllStub.py. Save it to the new name joinAll.py. Note the way an example is given in the documentation string. It simulates the use of the function in the Shell. This is a common convention: 

import string
'''exercise to complete and test this function'''
def joinStrings(sentance):
    '''Join all the strings in stringList into one string,
    and return the result. For example:
    >>> print joinStrings(['very', 'hot', 'day'])
    'veryhotday'
    '''
     # finish the code for this function
# i tried this but not sure whats mising
    for i in sentance:
        print(i)
    
    
   #this worked for numbers      
   # def sumList(nums):                                #1 
   # '''Return the sum of the numbers in nums.'''   
    #sum = 0                                       #2 
   # for num in nums:                              #3 
   #     sum = sum + num                           #4 
  #  return sum   
    
       
   
    


def main():
    print(joinStrings(['very','hot' ,'day']))
    print(joinStrings(['this', 'is', 'it']))
    print(joinStrings(['1', '2', '3', '4', '5']))

main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090219/90a6c4eb/attachment-0001.html>


More information about the Python-list mailing list