[Tutor] Python beginner having troubles understanding word listsand character lists
Alan Gauld
alan.gauld at btinternet.com
Thu Apr 29 01:38:40 CEST 2010
"Daniel" <asmosis.asterix at gmail.com> wrote
> I stumbled into lists of words and lists of characters. I have no
> explications in that book for those two and I didn't found some explications
> on the web.
aListOfWords = ['one','word','or','many']
aListOfCharacters = ['a','s','d','f']
aStringOfCharacters = 'asdf'
aWord = aStringOfCharacters
Now what part do you not understand?
> Could you point me to a link or something where I can read about
> them? I don't seem to understand why they are used.
You use a list of words any time you want to process multiple words.
For example a spelling checker may break a document into a list
of words and compare each word to a reference list of correctly
spelled words.
A list of characters is rarely used in Python since you can use
a string in almost every case.
You will find some more information in the "Raw Materials" topic
of my tutorial.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list