πŸ“Š Python
Q. What will the following code print?
Code:
x = [1, 2, 3]
x.append([4, 5])
print(len(x))
  • (A) 3
  • (B) 4
  • (C) 5
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 4

Explanation: `append()` adds the whole list as a single element, so length becomes 4.

Explanation by: Mr. Dubey
`append()` adds the whole list as a single element, so length becomes 4.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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