Finding the Index of an Item


We can find the index of an item present in the list using the .index method.

Sage Cell


A = [ 2, 3, 5, 7, 11 ]
print A.index(3)


Index between i and j

We can find the index of an item (x) between indices i and j, where i <= k < j. To do so, we call the .index method and specify the parameters in this order: .index(x, i, j)


A = [ 2, 3, 5, 7, 11, 2, 3, 5, 7, 11 ]
print A.index(3, 5, 9)


Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.




Date: 26 Mar 2019 12:13

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License