Question PRG-PY-0021
HardWhat is the output of this program?
a = [1, 2, 3]
b = a[:]
b.append(4)
print(a, b)
- A.
[1, 2, 3] [1, 2, 3, 4]
- B.
Error
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Python question
What is the output of this program?
a = [1, 2, 3]
b = a[:]
b.append(4)
print(a, b)
[1, 2, 3] [1, 2, 3, 4]
Error
Sign up free to see the answer and a step-by-step explanation.
[1, 2, 3] [1, 2, 3]
[1, 2, 3, 4] [1, 2, 3, 4]