简单的翻译器
# 初始化英汉词典
dictionary = {
"apple": "苹果",
"banana": "香蕉",
"cherry": "樱桃",
"orange": "橙子",
"pear": "梨子"
}
# 获取用户输入
word = input("请输入一个英文单词:")
# 查找对应的中文翻译
if word in dictionary:
print(word, "的中文翻译是", dictionary[word])
else:
print("抱歉,词典中没有这个单词。")
浙公网安备 33010602011771号