Q. What is the difference between following two expressions, if Ist is given as [1, 3, 5]


(i) lst * 3

(ii) lst *= 3


Answer =

In first case value of given list ‘lst’ will not change while in second case value of given list ‘lst’ will change.

(i) Give output [ 1,3,5,1,3,5,1,3,5]

(ii) lst *= 3 will change value of lst 
Now lst become
lst = [ 1,3,5,1,3,5,1,3,5]

10 Comments

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

  1. Replies
    1. (i) Give output [ 1,3,5,1,3,5,1,3,5]

      (ii) lst *= 3 will change value of lst
      Now lst become
      lst = [ 1,3,5,1,3,5,1,3,5]

      Delete
  2. lst*3

    it will repeat the list elements 3 time like [1,3,5,1,3,5,1,3,5]

    ReplyDelete
    Replies
    1. (i) Give output [ 1,3,5,1,3,5,1,3,5]

      (ii) lst *= 3 will change value of lst
      Now lst become
      lst = [ 1,3,5,1,3,5,1,3,5]

      Delete
  3. Is question ka (ii) part nahi hai .....

    ReplyDelete
  4. diff b/w 1st+3 and 1st+=[3] is the second part of the question

    ReplyDelete

Post a Comment

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

Previous Post Next Post