return number of occurrences array python dictionary code example Example: count occurrences of value in array python >>> l = ["a","b","b"] >>> l.count("a")