Q. What will be the output of this code?

Code:
a = [1, 2, 3]
print(a[::-1])
  • (A) [1, 2, 3]
  • (B) [3, 2, 1]
  • (C) [1, 3, 2]
  • (D) [2, 3, 1]
πŸ’¬ Discuss
βœ… Correct Answer: (B) [3, 2, 1]
Explanation: Slicing with -1 reverses the list.
Explanation by: Mr. Dubey
Slicing with -1 reverses the list.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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