Python Programming - Tricky Questions - Discussion
Discussion Forum : Tricky Questions - General Questions (Q.No. 34)
34.
What is the output of the following Python code?
x = [1, 2, 3]
y = x
y[0] = 10
print(x)
Answer: Option
Explanation:
y
is assigned a reference to the same list as x
, so modifying y
also modifies x
.
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