Python Programming - Tricky Questions - Discussion
Discussion Forum : Tricky Questions - General Questions (Q.No. 19)
19.
What is the output of the following Python code?
a = [1, 2, 3]
b = a[:]
a[0] = 10
print(b)
Answer: Option
Explanation:
Slicing creates a new copy of the list, so modifying
a
does not affect b
.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers