Skip to content

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

Léela en español

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

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

count function

How many elements of a list equal a value.

How to write it

count(list, x)

list
The list. Takes a list.
x
The value to count. Takes an expression.

Examples

  • count⁡([1,2,1],1)=2\displaystyle \operatorname{count}(\left[ 1, 2, 1 \right], 1) = 2
    count([1, 2, 1], 1)

    In the solver, count([1, 2, 1], 1) gives 2.

    Open in the solver
  • dimensions

    The size of a list or a matrix, level by level.

  • constant_array

    A list of copies of a value.

  • drop

    A list without its first elements.

  • complement

    The elements of a list that are in none of the others.

  • first

    The first element of a list.

  • apply

    Replace the head of an expression, or the brackets of a list, with a function.