Content · Programming · Python

Python tuple.index Method: Usage and Examples

tuple.index(value, start=0, stop=len(tuple)) locates the first equal element within a tuple and returns its index. See two practical examples, edge cases and common mistakes.

2 views Published Oct 17, 2026 Updated Oct 18, 2026 Admin

A fixed list of workflow phases needs the position of a phase.

What You Need to Understand


tuple.index(value, start=0, stop=len(tuple)) locates the first equal element within a tuple and returns its index.

When to Use It


A fixed list of workflow phases needs the position of a phase.

Step-by-Step Python Example


stages = ("new", "review", "done", "review")
print(stages.index("review"))
print(stages.index("review", 2))

How the Example Works


The earliest matching position is 1; searching from index 2 finds position 3.

Example Output


1
3
2

A Second Example


Compare this smaller variation with the main example, then experiment with your own values.

steps = ("a", "b", "a")
print(steps.index("a", 1))

Important Behavior and Edge Cases


Missing values raise ValueError; unlike str.find(), tuple.index() has no minus-one sentinel result.

Try It Yourself


Find the last occurrence of a repeated item by searching from a known position.

Common Beginner Mistakes


  • Missing values raise ValueError; unlike str.find(), tuple.index() has no minus-one sentinel result.
  • Using the wrong collection method for this operation without checking whether it mutates the object, returns a result, or raises on missing data.

Key Takeaways


  • tuple.index(value, start=0, stop=len(tuple)) locates the first equal element within a tuple and returns its index.
  • The earliest matching position is 1; searching from index 2 finds position 3.
  • Missing values raise ValueError; unlike str.find(), tuple.index() has no minus-one sentinel result.
Share this resourceSend this page to someone who may find it useful.