πŸ“Š Python
Q. What will be the output of this code?
Code:
a = [1, 2, 3]
a[1:2] = [7, 8]
print(a)
  • (A) [1, 7, 8, 3]
  • (B) [1, 2, 3]
  • (C) [1, 7, 2, 3]
  • (D) [1, 8, 3]
πŸ’¬ Discuss
βœ… Correct Answer: (A) [1, 7, 8, 3]

Explanation: Slicing assignment replaces the element at index 1 with two elements.

Explanation by: Mr. Dubey
Slicing assignment replaces the element at index 1 with two elements.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
42
Total Visits
πŸ“½οΈ
8 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
82%
Success Rate