index - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


index

find index of element within list

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

x.index(y)

Parameters

x

-

List object

y

-

Expression or Python expression

Description

• 

The index function returns the index of y within the List x. If y does not appear in x, a ValueError is raised.

• 

Note that as x is a Maple list, the index of the first element is 1.

Examples

The following interactive session illustrates the use of index:

>>> import maple

>>> import maple.namespace

>>> S1 = maple.execute('[ a, b, c, 2, 3, 4 ]:')

>>> S1.index( maple.namespace.b )

2

>>> S1.index( 3 )

5

>>> S1.index( maple.namespace.x )

ValueError: is not in list

See Also

member

OpenMaple

OpenMaple/Python/API

OpenMaple/Python/Expression

OpenMaple/Python/List