How do I join all the strings in a stringList into one without printing it?
For example,
s = joinStrings([’very’, ’hot’, ’day’]) # returns string 
print(s)                                # Veryhotday
How do I join all the strings in a stringList into one without printing it?
For example,
s = joinStrings([’very’, ’hot’, ’day’]) # returns string 
print(s)                                # Veryhotday
 
    
     
    
    it feels a little backwards, but you join with a chosen uhh seperator
''.join(['your','list','here'])
you can fill in the '' and it will use what ever is inside between each pair of items i.e '---'.join(['your','list','here']) will produce your---list---here
 
    
    You can solve it using single line for loop.
def joinStrings(stringList):
    return ''.join(string for string in stringList)
Everything is described in Python Documentation: Python Docs
E.g.: String join method: Python string methods
 
    
    Unfortunately, I am only learning python 2.7 so this probably won't help:
def joinStrings(stringList):
    list=""
    for e in stringList:
        list = list + e
    return list
s = ['very', 'hot', 'day']
print joinStrings(s)
 
    
    All the above solution are good... You can also use extend(object) function...
String1.extend(["very", "hot", "day"] )
Enjoy....
 
    
    