Time complexity of string concatenation in Python
<p>I'm analysing the complexity of my code.
From what I found online, since strings are immutable in python, a concatenation of a string and a character should be O(len(string) + 1).</p>

<p>Now, here is my piece of code (simplified):</p>

<pre><code>word = ""
for i in range(m):
    word = char_value + word
return word
</code></pre>

<p>The total time complexity should be:</p>

<p><em>(0+1) + (1+1) +...+ m = m(m+1)/2 = O(m^2)</em></p>

<p>Is this correct?</p>