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93X3dvcmRfZGV0YWlscyhpbmRleCk6CiAgICBpZiAwICZsdDs9IGluZGV4ICZsdDsgbGVuKHdvcmRzKToKICAgICAgICB3b3JkID0gd29yZHNbaW5kZXhdCiAgICAgICAgcHJpbnQoJnF1b3Q7XG7llq7oqZ7oqbPmg4XvvJomcXVvdDspCiAgICAgICAgcHJpbnQoZiZxdW90O+WWruipnu+8mnt3b3JkWyd3b3JkJ119JnF1b3Q7KQogICAgICAgIHByaW50KGYmcXVvdDvnv7vora/vvJp7d29yZFsndHJhbnNsYXRpb24nXX0mcXVvdDspCiAgICAgICAgcHJpbnQoZiZxdW90O+S+i+WPpe+8mnt3b3JkWydleGFtcGxlJ119XG4mcXVvdDspCiAgICBlbHNlOgogICAgICAgIHByaW50KCZxdW90O1xu54Sh5pWI55qE57Si5byV77yM6KuL6YeN6Kmm44CCXG4mcXVvdDspCgpkZWYgbWFpbigpOgogICAgd2hpbGUgVHJ1ZToKICAgICAgICBwcmludCgmcXVvdDtcbuatoei/juS9v+eUqOiqnuiogOWtuOe/kueoi+W8j++8gSZxdW90OykKICAgICAgICBwcmludCgmcXVvdDsxLiDmn6XnnIvmr4/ml6Xllq7oqZ4mcXVvdDspCiAgICAgICAgcHJpbnQoJnF1b3Q7Mi4g6YG45pOH5Zau6Kme5p+l55yL6Kmz5oOFJnF1b3Q7KQogICAgICAgIHByaW50KCZxdW90OzMuIOmboumWi+eoi+W8jyZxdW90OykKICAgICAgICBjaG9pY2UgPSBpbnB1dCgmcXVvdDvoq4vpgbjmk4flip/og70gKDEvMi8zKe+8miZxdW90OykKICAgICAgICAKICAgICAgICBpZiBjaG9pY2UgPT0gJnF1b3Q7MSZxdW90OzoKICAgICAgICAgICAgZGlzcGxheV93b3JkcygpCiAgICAgICAgZWxpZiBjaG9pY2UgPT0gJnF1b3Q7MiZxdW90OzoKICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgd29yZF9pbmRleCA9IGludChpbnB1dCgmcXVvdDvoq4vovLjlhaXllq7oqZ7nt6jomZ8gKDEtNCnvvJomcXVvdDspKSAtIDEKICAgICAgICAgICAgICAgIHNob3dfd29yZF9kZXRhaWxzKHdvcmRfaW5kZXgpCiAgICAgICAgICAgIGV4Y2VwdCBWYWx1ZUVycm9yOgogICAgICAgICAgICAgICAgcHJpbnQoJnF1b3Q7XG7oq4vovLjlhaXmnInmlYjnmoTmlbjlrZfjgIJcbiZxdW90OykKICAgICAgICBlbGlmIGNob2ljZSA9PSAmcXVvdDszJnF1b3Q7OgogICAgICAgICAgICBwcmludCgmcXVvdDvmhJ/orJ3kvb/nlKjvvIzlho3opovvvIEmcXVvdDspCiAgICAgICAgICAgIGJyZWFrCiAgICAgICAgZWxzZToKICAgICAgICAgICAgcHJpbnQoJnF1b3Q7XG7nhKHmlYjpgbjmk4fvvIzoq4vph43oqabjgIJcbiZxdW90OykKCiMg6YGL6KGM56iL5byPCmlmIF9fbmFtZV9fID09ICZxdW90O19fbWFpbl9fJnF1b3Q7OgogICAgbWFpbigp
# 單詞數據庫
words = [
{"word": "Hello", "translation": "你好", "example": "Hello! How are you?"},
{"word": "Thank you", "translation": "謝謝", "example": "Thank you for your help."},
{"word": "Goodbye", "translation": "再見", "example": "Goodbye! See you tomorrow."},
{"word": "Please", "translation": "請", "example": "Please pass me the salt."},
]
def display_words():
print("每日單詞列表:")
for i, word in enumerate(words, start=1):
print(f"{i}. {word['word']} - {word['translation']}")
def show_word_details(index):
if 0 <= index < len(words):
word = words[index]
print("\n單詞詳情:")
print(f"單詞:{word['word']}")
print(f"翻譯:{word['translation']}")
print(f"例句:{word['example']}\n")
else:
print("\n無效的索引,請重試。\n")
def main():
while True:
print("\n歡迎使用語言學習程式!")
print("1. 查看每日單詞")
print("2. 選擇單詞查看詳情")
print("3. 離開程式")
choice = input("請選擇功能 (1/2/3):")
if choice == "1":
display_words()
elif choice == "2":
try:
word_index = int(input("請輸入單詞編號 (1-4):")) - 1
show_word_details(word_index)
except ValueError:
print("\n請輸入有效的數字。\n")
elif choice == "3":
print("感謝使用,再見!")
break
else:
print("\n無效選擇,請重試。\n")
# 運行程式
if __name__ == "__main__":
main()