[Tutor] Help me in this programme

Alan Gauld alan.gauld at btinternet.com
Thu Oct 6 11:01:52 CEST 2011


On 06/10/11 08:15, Praveen Singh wrote:

> CountWords("google")
> [('e',1),('g',2),('l',1),('o',2)]
>
> by the level of this question you can easily understand i am new in
> python.the problem i am facing is how to make set of word and count(e,1)
> and add this to list??

Some clues:

a for loop will iterate over a string:

for letter in "google":
     print letter


A dictionary holds a value against a key.
A key can be a letter. The corresponding value can be a number.


Does that help?
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list