利用wix建手机网站,南京制作网站优化,购物软件,ps学做翻页相册网站【程序分析】 ● 字典中的条目是没有顺序的。 ● 可以对字典使用如下方法#xff1a; keys()、values()、 items()、 clear()、 get(key)、 pop(key) 和popitem()【程序代码】
dictionary{dog:狗,apple:苹果,banana keys()、values()、 items()、 clear()、 get(key)、 pop(key) 和popitem()【程序代码】
dictionary{dog:狗,apple:苹果,banana:香蕉,cat:猫,peach:桃子
}def find(word):return dictionary.get(word, Sorryno finding.)while True:xinput(Please input a word (input q to exit):)if xq:breakmeaningfind(x)#print(f{x}s meaning{meaning})print({}s meaning{}.format(x,meaning))
【程序输出】
Please input a word (input q to exit):dog
dogs meaning狗
Please input a word (input q to exit):cat
cats meaning猫
Please input a word (input q to exit):op
ops meaningSorryno finding.
Please input a word (input q to exit):q