Q. Find the errors:


L1 = [1, 11, 21, 31]

L2 = L1 + 2

L3 = L1 * 2

Idx = L1.index(45)


Answer =

Error in Line 2 & 4.

Because in Line 2 , 2 is integer not list so, it can not directly add to L2.

in Line 4, index 45 not exist in L1.

2 Comments

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

  1. What is the reason?

    ReplyDelete
    Replies
    1. Because in Line 2 , 2 is integer not list so, it can not directly add to L2.

      in Line 4, index 45 not exist in L1.

      Delete

Post a Comment

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

Previous Post Next Post