Python

Python Menu

Python

Python List index() - Definition, Syntax, Parameters, Examples

Definition

The index() method returns the position at the first occurrence of the specified value.

Syntax

list.index(n)

Parameters

Parameter Description
n Required. Any type (string, number, list, etc.). The element to search for

Examples:

cars = ['Nissan', 'Ford', 'Volkswagen'] j = cars.index('Ford') print(j)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods