What will be the output of the following Python code? L = [1, 2, 1, 5, 4, 1,…

2026

What will be the output of the following Python code?

L = [1, 2, 1, 5, 4, 1, 3, 1]
print(L.index(L.count(1)))

Answer: B. 4

  1. A.

    5

  2. B.

    4

  3. C.

    ValueError

  4. D.

    IndexError

Attempted by 269 students.

Show answer & explanation

Correct answer: B

Explore the full course: Bpsc

Loading lesson…