Q. Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?

  • (A) print(list1[0])
  • (B) print(list1[:2])
  • (C) print(list1[:-2])
  • (D) all of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) all of the mentioned
Explanation: slicing is allowed in lists just as in the case of strings.

Explanation by: Mr. Dubey
slicing is allowed in lists just as in the case of strings.

πŸ’¬ Discussion

πŸ“Š Question Analytics

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