Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct (multiple answers allowed) ?
A. print(list1[0])
B. print(list1[:2])
C. print(list1[:-2])
D. print(list1[4:6])
Answer:A
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct (multiple answers allowed) ?
A. print(list1[0]) B. print(list1[:2]) C. print(list1[:-2]) D. print(list1[4:6])
Explanation:Slicing is allowed in lists just as in the case of strings.