[Tutor] Help on reading a plain file of names

Alan Gauld alan.gauld at btinternet.com
Fri Mar 11 09:36:10 CET 2011

"apple owner" <smerkyd at aol.com> wrote

> I am new to python and I am trying to open a plain
> text file of names and to see the number of names
> that start with specific letters and display them
> in a bar graph.

OK, Lets break that down so that we can understand
what exactly puzzles you:

1) Can you open a text file and read it?
2) Can you figure out if a string(a name) startwith a specific latter?
3) Can you build a collection based ion the starting letter - a 
dictionary maybe?
4) Can you display the dictionary keys and values on a graph?

Can you try to solve each part of the problem separately
and then put the pieces together for your final solution?

Try posting back with specific questions and example code
where you have tried to solve the problem. That makes it
easier for us to se where you are having trouble.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list