I tried replying with inline the questions
read below within your mail

On Tue, Jul 13, 2010 at 8:13 PM, ZUXOXUS <zuxo...@gmail.com> wrote:

> Hi,
>
> I am a true beginner in programming, and im learning with
> inventwithpython.com.
>
> There's something I dont understand, and i would really appreciate any
> help.
>
> In chapter 9, the one about the Hangman game, I don't get the block of code
> in line 61
>
> 59.  words = 'ant baboon badger bat bear'
> 60.
>
>    1. def getRandomWord(wordList):
>    2.     # This function returns a random string from the passed list of
>    strings.
>    3.     wordIndex = random.randint(0, len(wordList) - 1)
>    4.     return wordList[wordIndex]
>
>
> The thing is, the "passed list of strings" is called "words", not
> "wordList", so I see it shouldn't work.
>

>> wordList is just a parameter defined for the function and the code which
you are showing, it does not call the function anywhere, there should be
another line like

print getRandomWord(words)

>
> On the other hand, the variable "wordList" is defined nowhere!
>

>> You dont have to define the function parameters usually as you can use
them as they are appearing. In this case, wordList is parameter to funtion
which will be replaced with passed value when the function is called


> The code is ok, because the program runs ok. So there is somethings that i
> dont get.
>
> Thank you very much in advance.
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


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

Reply via email to