-2
我想用隨機的水果字進行測驗,但我得到的問題總是相同的。這是爲什麼?從早期陳述循環
import random
from random import shuffle
fruit = ("banana", "apple", "Avocado", "Blackberry", "Coconut", "Durian", "Dragon Fruit", "Eggplant", "Feijoa")
word = random.choice(fruit)
shuffled = list(word)
random.shuffle(shuffled)
shuffled = ''.join(shuffled)
qas = [(shuffled, word),
(shuffled, word),
(shuffled, word),
]
for question, rightAnswer in qas:
answer = raw_input(question + ' ')
if answer == rightAnswer:
print 'Right!'
else:
print 'No... the answer is ' + rightAnswer
如果腳本正常工作,問題會是什麼樣子? – John1024