Python Programming - Tricky Questions - Discussion
Discussion Forum : Tricky Questions - General Questions (Q.No. 29)
29.
What is the output of the following Python code?
x = [1, 2, 3, 4, 5]
result = x[-2:-1]
print(result)
Answer: Option
Explanation:
Slicing with indices -2:-1 returns a list containing the element at index -2 (counting from the end).
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers