human
Print all words occurring in a sentence exactly K times | Function to print all the words occurring k times in a string.
Stores the words.
Traverse the list.
Check for count.
Print the word.
Remove from list.
Driver Code.
Given string.
Given value of K.
Function call to find all words occuring K times"
How can the above be solved in Python?

Write me a code to print all words occurring in a sentence exactly K times and the other steps required?
assistant
#Here is code to print all words occurring in a sentence exactly K times and the other steps required.
 def kFreqWords ( S , K ) :
	l = list ( S . split ( " ▁ " ) )
	for i in l :
		if l . count ( i ) == K :
			print ( i )
			l . remove ( i )
if __name__ == " _ _ main _ _ " :
	S = " banana ▁ is ▁ in ▁ yellow ▁ and ▁ sun ▁ flower ▁ is ▁ also ▁ in ▁ yellow "
	K = 2
	kFreqWords ( S , K )