_mateo
6/21/2019 - 8:02 PM

New String from First/Last Characters of Given String

Form a New String Made of the First 2 and Last 2 characters From a Given String

def formatList(inputList):
    retString = ""
    for item in inputList:
        retString+= str(item)+", "
    return retString[:-2]

myList = [1,2,3,4,5]
print(formatList(myList))