Write a program that accepts a filename as a command-line parameter. The program
will search the given file for each letter in the alphabet and print statistics on the
number of occurrences.

I was wondering if i could have some help with this as i dont understand how to do it, and it is important to get it completed any help will be much appreciated?

Thanks

Tis a long time since I've coded any Python, so you may find the help of others more useful. But to get you started in the right direction, you'll likely need to...

Use sys.argv to obtain the command line parameters, as documented here:
http://docs.python.org/library/sys.html?highlight=sys.argv#sys.argv

Read in the file, see section "7.2 Reading and Writing Files":
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files

Loop through each character, see "4.2. for Statements":
http://docs.python.org/tutorial/controlflow.html#for-statements

Use a dictionary object to store the frequency of characters, see "5.8. Mapping Types - dict":
http://docs.python.org/library/stdtypes.html#mapping-types-dict

The rest you should be able to figure out, assuming you're already familiar with "hello world" ;-)

There's some reading to do here of the documentation, but not too much. Programming is often like that. Hope this gets you started.

commented: correct kind of advice +12

You'll want to read up on the "raw input" function in python. You can use it to enter anything (integers, strings, floats) directly from the command line to the program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.