Q. How are the statements Ist = Ist + 3 and lst += [3] different, where Ist is a list? Explain.


Answer =

Ist = Ist + 3 will give an error.

While, in Ist += [3] here [3] add in list lst.

Because when used with lists, the + operator requires both the operands as list-types.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post