<prompt> Automate the given task and output the resulting code.Task: Write a program that reads a text file and prints out the number of words in the file.  <response>: Below is the program that reads a text file, counts the number of words in it, and prints the result.python open the file with read access with openfile.txt, r as f: read the content content f.read split the content based on the white spaces words content.split count the number of words count lenwords print the result printThe number of words in the file is, count 