Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions