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]
part of qn is missing?
ReplyDeleteWhich part.
Deletenot an understanding answer
ReplyDelete(i) Give output [ 1,3,5,1,3,5,1,3,5]
Delete(ii) lst *= 3 will change value of lst
Now lst become
lst = [ 1,3,5,1,3,5,1,3,5]
lst*3
ReplyDeleteit will repeat the list elements 3 time like [1,3,5,1,3,5,1,3,5]
(i) Give output [ 1,3,5,1,3,5,1,3,5]
Delete(ii) lst *= 3 will change value of lst
Now lst become
lst = [ 1,3,5,1,3,5,1,3,5]
Is question ka (ii) part nahi hai .....
ReplyDeletePlease check it again.
DeletePlease tell whole question.
ReplyDeletediff b/w 1st+3 and 1st+=[3] is the second part of the question
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )