chars = ['H', 'e', 'l', 'l', 'o'] r = '' for s in chars: r += s print(r)
chars = ['H', 'e', 'l', 'l', 'o'] print(''.join(chars))
Using str.join(sequence) is faster, uses less memory and increases readability compared to for-loop iteration.
str.join(sequence)