CPython provides a special case, but for that, you should have one reference to a string and you concatenate another string to the end, now special cases this and tries to extend the string in place.
And one advantage of using this is you can get the solution in O(n) time complexity.
e.g.
s = "" for i in range(n):
s+=str(i)
Another thing you can use the .join() function to concatenate the string below is the code for that:-
l=[]
l.append(‘foo’)
l.append(‘bar’)
l.append(‘baz’)
s=’ ‘.join(l)
print(s)