Q. What does the following slice return? `a = [1, 2, 3, 4, 5]` `a[1:4]`

Code:
a = [1, 2, 3, 4, 5]
  • (A) [1, 2, 3]
  • (B) [2, 3, 4]
  • (C) [2, 3, 4, 5]
  • (D) [4, 5]
πŸ’¬ Discuss
βœ… Correct Answer: (B) [2, 3, 4]
Explanation: Slice includes index 1 up to but not including index 4.
Explanation by: Mr. Dubey
Slice includes index 1 up to but not including index 4.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
96
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
81%
Success Rate