Python Programming - Variables - Discussion
Discussion Forum : Variables - General Questions (Q.No. 34)
34.
What is the output of the following code:
my_list = [1, 2, 3]
my_list.append([4, 5])
print(my_list)
Answer: Option
Explanation:
In this code, a list my_list
is defined with the values [1, 2, 3]
.
The second line appends the list [4, 5]
to my_list
.
When the modified list is printed to the console, the output is [1, 2, 3, [4, 5]]
.
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