0

I understand that you cannot concatenate a list and a string. So it makes sense that a=a+'abc' throws an exception "TypeError: can only concatenate list (not "str") to list".

But why does a+='abc' result in a == ['a','b','c']?

I thought a = a+b and a+=b should always give the same result.

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
tony ladd
  • 9
  • 1

0 Answers0