Write a python function to count the occurrences of a value in a list.
Topic: Write a python function to count the occurrences of a value in a list.
Solution
def count_occurrences(lst, val): return lst.count(val)
List all Python Programs
Solution
def count_occurrences(lst, val): return lst.count(val)