这里有一个相同问题: 请查看是否对问题有帮助~
https://ask.csdn.net/questions/7705109
import random
right = 0
num = 1
W = ['play', 'guess', 'english']
repeat = 'yes'
while num < len(W)+ 1:
word = random.choice(W)
word1 =word
answer = word
a = ''
for i in word:
postion = random.randrange(len(word))
a += word[postion]
word = word[0:postion] + word[(postion+1):]
print("乱序后的单词:", a)
guess = input("输入你的猜测:")
while guess != answer:
guess = input("重新猜测:")
print("猜对了")
W.remove(word1)
right += 1
print("一共猜对了{}个词".format(right))
print("游戏结束")
望采纳!谢谢
问题重复提问啦
W.remove(guess)