Q.

In python, the list L contains the following elements : ['A', 1,'1','George']. Which of the following ways of slicing would assign only the first two elements to the variable X ?

A. l[1:2]
B. x=l[0:1]
C. x=[l[0:2]
D. none of the above
Answer» C. x=[l[0:2]
1.2k
0
Do you find this helpful?
13

Discussion

No comments yet