Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

part function

Read part of a list by position, counting from 1; also written list[i].

How to write it

part(list, i)

One element.

list
The list. Takes a list.
i
The position. Takes a whole number.

part(list, i, j)

An element of a list of lists.

list
A list of lists. Takes a list.
i
The row. Takes a whole number.
j
The column. Takes a whole number.

Examples

  • part⁡([10,20,30],2)=20\displaystyle \operatorname{part}(\left[ 10, 20, 30 \right], 2) = 20
    part([10, 20, 30], 2)

    In the solver, part([10, 20, 30], 2) gives 20.

    Open in the solver
  • part⁡((1234),2,1)=3\displaystyle \operatorname{part}\left(\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, 2, 1\right) = 3
    part([[1, 2], [3, 4]], 2, 1)

    In the solver, part([[1, 2], [3, 4]], 2, 1) gives 3.

    Open in the solver
  • replace_part

    A list with the part at a position replaced; write position -> value.

  • partition

    A list split into blocks of a given length.

  • nest_list

    The steps of nest: the value after each application, starting from the first.

  • position

    Where a value occurs in a list, as a list of positions.

  • nest

    Apply a function again and again to a value.

  • prepend

    A list with an element added at the start.