Question:

What will be the result of the following code?

fruits = ['apple','banana','cherry']
print(fruits[0])

Show Hint

Python lists start indexing from \(0\). The first element is accessed using index \(0\), the second using \(1\), and so on.
Updated On: Mar 14, 2026
  • apple
  • banana
  • cherry
  • Error
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Understand the concept of lists in Python.
In Python, a list is an ordered collection of elements. Elements in a list are accessed using their index values. Indexing in Python always starts from \(0\).
For example, if a list contains three elements, the indexes will be \[ 0,1,2 \] respectively.
Step 2: Analyze the list given in the program.
The list defined in the code is \[ ['apple','banana','cherry'] \] The indexing of the list elements will be \[ 0 \rightarrow apple \] \[ 1 \rightarrow banana \] \[ 2 \rightarrow cherry \] Step 3: Evaluate the print statement.
The program prints \[ fruits[0] \] Since index \(0\) corresponds to the first element of the list, the value returned will be \[ apple \] Step 4: Conclusion.
Therefore the output of the program is \[ apple \]
Was this answer helpful?
0
0