Advertisements
Advertisements
प्रश्न
Find the output from the following code:
L=[100,200,300,400,500]
L1=L[2:4]
print L1
L2=L[1:5]
print L2
L2. .extend(L1)
print L2कोड लेखन
Advertisements
उत्तर
L[2:4]selects elements at index2and3.L[1:5]selects elements from index1up to index4.extend()adds all elements ofL1toL2.
Output:
[300, 400]
[200, 300, 400, 500]
[200, 300, 400, 500, 300, 400]shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
