简单的翻译器

# 初始化英汉词典
dictionary = {
"apple": "苹果",
"banana": "香蕉",
"cherry": "樱桃",
"orange": "橙子",
"pear": "梨子"
}

# 获取用户输入
word = input("请输入一个英文单词:")

# 查找对应的中文翻译
if word in dictionary:
print(word, "的中文翻译是", dictionary[word])
else:
print("抱歉,词典中没有这个单词。")

posted @ 2023-04-19 21:58  朱阿九  阅读(22)  评论(0)    收藏  举报