有人可以向我解释一下这个循环的最后一行是做什么的吗?这是一个单词混乱程序的片段,是我正在学习的一本书的一个例子。谢谢你。
import random
WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone")
word = random.choice(WORDS)
correct = word
jumble = " "
while word:
position = random.randrange(len(word))
jumble += word[position]
word = word[:position] + word[(position +1):]