Answer:
import string
print 'Enter filename'
filename = raw_input()
filedata = open(filename, 'r').read()
print 'Lines:',len(filedata.splitlines())
print 'Words:',len(string.split(filedata))
print 'Chars:',len(filedata)
Step-by-step explanation:
Python programming language is a language that was designed by Guido Van Rossum in the year 1991 and works on operating systems such as Linux, Windows Vista and many more OS or operating system.
In this question we are asked to write a program version that should accept a file name as input and "then print three numbers showing the count of lines, words, and characters in the file."
Hence, in this question always remember to put your code file as well as your example.txt file in the same folder.
import string
print 'Enter filename'
filename = raw_input()
filedata = open(filename, 'r').read()
print 'Lines:',len(filedata.splitlines())
print 'Words:',len(string.split(filedata))
print 'Chars:',len(filedata)