Question: Python: 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

Python:

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:

def joinStrings(stringList): '''Join all the strings in stringList into one string,  and return the result, NOT printing it. For example:    >>> s = joinStrings(['very', 'hot', 'day']) # returns string  >>> print(s)   veryhotday  ''' 
This is a form of accumulation, but not quite the same as adding numbers.
Start with nothing accumulated does not mean 0, here. Think what is appropriate.

I need to finish the code:

def joinStrings(stringList): '''Join all the strings in stringList into one string, and return the result, NOT printing it. For example: >>> s = joinStrings(['very', 'hot', 'day']) # returns string >>> print(s) veryhotday ''' # finish the code for this function

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

main()

I am confused on how to join all of the strings.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!