[Tutor] Word Jumble - Chpt4 (Explanation)
Arvind Virk
arvind.s.virk at hotmail.co.uk
Thu May 16 22:03:03 CEST 2013
Hi guys!
This is my first post so go gentle. I'm just getting into Python programming and am having an issue understanding the Word Jumble Game.
import random
WORDS = ('python','jumble','easy','difficult','lower','high')word = random.choice(WORDS)correct = wordjumble = ""
while word: position = random.randrange(len(word)) jumble += word[position] word = word[:position] + word[(position+1):]
======
I cannot understand what it is trying to do in the while loop.If the word was python and position lets say was 3 then jumble would = python(3). I cannot understand what the next line does! Please help!
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130516/96b9b199/attachment-0001.html>
More information about the Tutor
mailing list