The list.index(x[, start[, end]]) is used to ___

17. The list.index(x[, start[, end]]) is used to ___.

  1. Return zero-based index in the list
  2. Raises a ValueError if there is no such item
  3. Both A and B
  4. None of the mentioned above

Answer: C) Both A and B

Explanation:

The index(x[, start[, end]]) is used to return the zero-based index in the list of the first item whose value is equal to x. index() is used to return the zero-based index in the list of the first item whose value is equal to x. If there is no such item, the method raises a ValueError. The optional arguments start and end are interpreted in the same way as in the slice notation and are used to restrict the search to a specific subsequence of the list of elements. Instead of using the start argument to calculate the index, the returned index is computed relative to the beginning of the full sequence.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.