> The thing is, the "passed list of strings" is called "words",
> not "wordList", so I see it shouldn't work.
>
> On the other hand, the variable "wordList" is defined nowhere!

"wordList" is just a name that the function (getRandomWord) uses to
refer to
whatever values get passed to it. Remember that you don't have to put
your
list of words into a variable before you call the function.  You could
just
do this:-

getRandomWord('ant baboon badger bat bear')

...and it will work. Or consider having two or three variables:-

   words     = 'ant baboon badger bat bear'
   mylist    = 'left right backward forward up down'
   morestuff = 'run walk stand sit'

Naturally you can feed any of these into the function:-

   getRandomWord(words)
   getRandomWord(mylist)
   getRandomWord(morestuff)

You can think of "getRandomWord(wordList)" as a convenient
shorthand for:-

   wordList = words     
   getRandomWord(wordList)

Hope this helps

-- 
Michael
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to