Code:
>>> sum(['1','2'])
Error:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
As I haven't passed integer in the list, I didn't expect it is summing int
and str
. Both are strings.
Can anyone please explain, why error say `int?