+1 vote
can you give an example using a sample list having numbers from 0-10.
May 2, 2019 in Python 3,138 views

## 2 answers to this question.

+1 vote
suppose you have a list

a = [0,1,2,3,4,5,6,7,8,9,10]

now if you want to count the items in your list. you should have a value at your disposal

suppose you want to check the count the number of times 2 is in your list.

a.count(2)

it will give you the count.

In this case if you want the number of items in your list you can just check the length

len(a)

it will give you the number of items in your list.
• 3,230 points

Syntax :

list. count(value)

Code:

```colors = ['red', 'green', 'blue', 'black']
```

Return the number of times the value' blue' appears int in the colors list

```x= colors.count("blue")
print(x)
Output: 1```
• 330 points

edited Jul 8, 2019 by Kalgi

## In a list of dictionaries, how can I find the minimum calue in a common dictionary field.

There are several options. Here is a ...READ MORE

## how can i use the sum function in a python list?

If there is list =[1,2,4,6,5] then use ...READ MORE

## How can I count the occurrences of a list item?

If you only want one item's count, ...READ MORE

## How can I count the occurrences of a list item?

For Counting the occurrences there are many ...READ MORE

## How can I convert a list of dictionaries from a CSV into a JSON object in Python?

You could try using the AST module. ...READ MORE

## how do i change string to a list?

suppose you have a string with a ...READ MORE

## how can i randomly select items from a list?

You can also use the random library's ...READ MORE