大家好,我打的程式碼不知是哪裡有誤,因為我是想讓他先發送一個字,然後顯示
請輸入字彙,但不論怎樣修改,都先跑出請輸入字彙。此外如果我想從列表中,隨機
取三個應如何使用random shuffle()呢?感謝大家。
下面是我的程式碼
Dict={"警察":"勇敢","護士":"溫柔","醫生":"道德","老師":"耐心",
"工程師":"好命","老闆":"有錢"}
def associate(Dict):
for word in Dict.keys():
print("\n")
print(word)
correct=0
incorrect=0
term=input ("請輸入詞彙:")
if term==Dict[associate]:
print("答對了!\n")
correct+=1
else:
incorrect+=1
print("答錯了,應該是%s...\n"%Dict[associate])
incorrect+=1
associate(Dict)