# Write a Python program to Retain records with N occurrences of K # Python3 code to demonstrate working of# Retain records with N occurrences of K# Using count() + list comprehension# initializing listtest_list = [(4, 5, 6, 4, 4), (4, 4, 3), (4, 4, 4), (3, 4, 9)]# printing original listprint("The original list is : " + str(test_list))# initializing KK = 4# initializing NN = 3# Retain records with N occurrences of K# Using count() + list comprehensionres = [ele for ele in test_list if ele.count(K) == N]# printing resultprint("Filtered tuples : " + str(res))