1 How many list objects are created by the code below x 5
1. How many list objects are created by the code below?
>>> x = [5]
>>> y = x
>>> z = y+x
>>> x.append(10)
2. How many str objects are created by the code below?
>>> x = \'ab\'
>>> y = x
>>> z = x
>>> z += \'c\'
3. How many objects are created by the code below?
>>> lst_one = [1]
>>> lst_two = [2]
>>> lst_three = [lst_one, lst_two]
Solution
1: 15 list object are created x.append(10) before that x had 5 list objects
2: three string objects are created x = ab , y =ab and z = abc
![1. How many list objects are created by the code below? >>> x = [5] >>> y = x >>> z = y+x >>> x.append(10) 2. How many str o 1. How many list objects are created by the code below? >>> x = [5] >>> y = x >>> z = y+x >>> x.append(10) 2. How many str o](/WebImages/39/1-how-many-list-objects-are-created-by-the-code-below-x-5-1119461-1761595377-0.webp)
