Question DSA-ARR-0003
EasyWhat is the output of this code?
a = [1, 2, 3]
a.append(4)
print(a)
- A.
[4, 3, 2, 1]
- B.
[1, 2, 3, 4]
- C.
Show answer and explanation
Answer: B
append adds 4 to the end of the list.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Arrays question
What is the output of this code?
a = [1, 2, 3]
a.append(4)
print(a)
[4, 3, 2, 1]
[1, 2, 3, 4]
Answer: B
append adds 4 to the end of the list.
[1, 2, 3]
[4]