Inefficient string concatenation inside loop
Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.
def string_concatenation_noncompliant():
    samplelist = ['sampleString1', 'sampleString2', 'sampleString3']
    concatenatedstring = ''
    for item in samplelist:
        # Noncompliant: inefficient string concatenation inside a loop is used.
        concatenatedstring += item + "\n"
    return concatenatedstring
def string_concatenation_compliant():
    samplelist = ['sampleString1', 'sampleString2', 'sampleString3']
    concatenatedlist = []
    for item in samplelist:
        concatenatedlist.append(item)
        concatenatedlist.append("\n")
    # Compliant: join function is used for string concatenation
    concatenatedstring = ''.join(concatenatedlist)
    return concatenatedstring