# Write a Python program to Count occurrences of an element in a list # Python code to count the number of occurrencesdef countX(lst, x):    count = 0    for ele in lst:        if (ele == x):            count = count + 1    return count# Driver Codelst = [8, 6, 8, 10, 8, 20, 10, 8, 8]x = 8print('{} has occurred {} times'.format(x, countX(lst, x)))