Hey,
thanks for your help!
I couldn't understand because I didn't see that further down in the code, as
Serdar Tumgoren said, the function was called:
secretWord = getRandomWord(words)
without that line I couldn't get it.
Thank you very much, everybody, great explanations.
Alan, I have been c
"ZUXOXUS" wrote
59. words = 'ant baboon badger bat bear'
1. def getRandomWord(wordList):
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.
The rest of the list does a great job explaining the situation, which bears
out in the code itself. If you look farther down in the code sample in
Chapter 9, you'll see the function called twice.
http://inventwithpython.com/chapter9/
<< snipped >>
print('H A N G M A N')
missedLetters = ''
correct
> 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 t
ZUXOXUS 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. wo
I tried replying with inline the questions
read below within your mail
On Tue, Jul 13, 2010 at 8:13 PM, ZUXOXUS 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.
>
ZUXOXUS, 13.07.2010 16:43:
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