用户:
屑雷神索尔查看:1 回复:2 评论:1 创建时间:2019-08-28T21:44:22
【作品展示】

【作品介绍】
由字典做成的單詞本
【作品源代码】
words={}
def add():
answer1=input('你要添加什么單詞?')
if not answer1 in words.keys():
answer2=input('這個單詞是什么意思?')
words[answer1]=answer2
print('目前的單詞本:',words)
else:
print('這個單詞已經在單詞本里了')
def find():
answer1=input('你要查什么單詞?')
if answer1 in words.keys():
print(answer1,'的意思是:',words[answer1])
else:
print('對不起,你要查的單詞不存在!')
def delete():
answer1=input('你想刪除什么單詞?')
if answer1 in words.keys():
print(answer1,'的意思是:',words[answer1])
del words[answer1]
print('已刪除',answer1)
while True:
answer1=input('輸入指令:1 添加,2 查詢,3 刪除,4 退出:')
if answer1=='1':
add()
elif answer1=='2':
find()
elif answer1=='3':
delete()
elif answer1=='4':
print('謝謝使用!')
break
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn