Python Programming - Tricky Questions - Discussion
Discussion Forum : Tricky Questions - General Questions (Q.No. 11)
11.
What is the output of the following Python code?
def modify_list(my_list):
my_list[0] = 5
original_list = [1, 2, 3]
modify_list(original_list.copy())
print(original_list)
Answer: Option
Explanation:
The
modify_list
function modifies a copy of the list, not the original list.
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