python 新手问题求助
目的:创建一个随机显示一组单词的程序,要求该程序能打印出所有的单词,但不能重复
我现在在学列表和函数。还没有学到函数。
我能感觉到会有错误,如果还有机会抢救的话 请帮我指出来。如果不能抢救。就请大神帮我写一下
import random
WORDS=("python","pycharm","amazeing","surprse")
Max_word=len(WORDS)
i=0
word=random.choice(WORDS)
used=[]
guess=word
while i<Max_word :
while guess in used:
guess=random.choice(word)
print(guess)
i+=1
used.append(guess)
if i==Max_word:
print(used)