Python-Quizzes | Python List Quiz | Question 5
Find the output of the following program:
When assigning check1 to check2, we create a second reference to the same list. Changes to check2 affect check1. When assigning the slice of all elements in check1 to check3, we are creating a full copy of check1 which can be modified independently (i.e, any change in check3 will not affect check1).
So, while checking check1 ‘Code’ gets matched and the count increases to 1, but Mcq doesn’t get matched since its available only in check3.
Now checking check2 here also ‘Code’ gets matched resulting in a count value to 2.
Finally while checking check3 which is separate from both check1 and check2 here only Mcq gets matched and the count becomes 12.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Please Login to comment...