On Thu, May 21, 2009 at 2:42 AM, spir <denis.s...@free.fr> wrote:

> <snip>
>    while word:
>         position = random.randrange(len(word))
>        jumble += word[position]
>        word = word[:position] + word[(position + 1):]
>

Something that many of us use for debugging, and is also useful for
comprehension is a simple print statement. If you were to convert the loop
to this:

while word:
        position = random.randrange(len(word))
       jumble += word[position]
       word = word[:position] + word[(position + 1):]
       print jumble
       print word
       # Optional - for further understanding
       print word[:position]
       print word[(position+1):]

you would basically see what Denis wrote - only every step through the loop.

HTH,
Wayne

p.s. - When you start graphical programming, I'd look at pyglet or pygame.
Although to really understand event driven programming, it really helped me
to start writing programs with Tkinter. YMMV
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to