Python Programming - Data Types - Discussion

Discussion Forum : Data Types - General Questions (Q.No. 33)
33.
What is the output of the following code snippet?
my_list = [1, 2, 3, 4, 5]
print(my_list[1:4])
[2, 3, 4]
[1, 2, 3]
[1, 2, 3, 4]
[3, 4, 5]
Answer: Option
Explanation:
Slicing is used to extract a portion of a list. The specified range is [1:4], which includes elements at indices 1, 2, and 3.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.