Programming

The difference between a=a+b and a+=b in Python

Chetan Ambi
Towards AI

--

Introduction

I am sure you are already aware of the concatenation operators + and += in Python. As the name itself says, concatenation operators are used to concatenating multiple sequence types (For example, concatenate two lists). Similarly, * and *= are used when you want to repeat a sequence type n times. You also know that…

--

--