import random
words = ["Football" , "Happy" ,"Sad", "Love", "Human"]
for word in words:
word = random.choice(words)
print(word)
words.remove(word)
위의 코드는 왜 모두 5 대신 3 단어 만 출력합니까? words
의 단어를 잘못된 순서로 임의의 순서로 인쇄하려고합니까?파이썬 목록이 제대로 작동하지 않습니다.
['rando m.shuffle'] (http://stackoverflow.com/questions/473973/shuffle-an-array-with-python)를 참조하십시오. – Blorgbeard