count the number of ldt in python code example
Example 1: how to count things in a list python
list.count(element)
list1 = ['red', 'green', 'blue', 'orange', 'green', 'gray', 'green']
color_count = list1.count('green')
print('The count of color: green is ', color_count)
Example 2: python count
Format: string.count(sub, start= 0,end=len(string))
string = "Add Grepper Answer"
print(string.count('e')
>>> 3