Python Version of my program to count the number of occurences of a word or words