Vidyalelo
Python · Q45

Python Lists MCQs: Exam Practice for List Concepts

Programming · Python · question 45

Q45

What will be the output of the following Python code? veggies = ['carrot', 'broccoli', 'potato', 'asparagus'] veggies.insert(veggies.index('broccoli'), 'celery') print(veggies)

A.
['carrot', 'celery', 'broccoli', 'potato', 'asparagus'] Correct 1.00
Answer
B.
['carrot', 'celery', 'potato', 'asparagus']
C.
['carrot', 'broccoli', 'celery', 'potato', 'asparagus']
D.
['celery', 'carrot', 'broccoli', 'potato', 'asparagus']

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board