您好,登錄后才能下訂單哦!
作業(yè):
1、每周寫一篇博客
2、編寫登錄接口
輸入用戶名密碼
認(rèn)證成功后顯示歡迎信息
輸錯三次后鎖定
3、多級菜單
三級菜單
可依次選擇進(jìn)入各子菜單
所需新知識點(diǎn):列表、字典
data = { "水果":{ "香蕉":{ "產(chǎn)地":["海南","馬爾代夫"], "價格":[9.9,29.9] }, "蘋果":{ "產(chǎn)地":["美國","山東"], "價格":[1.2,5.5] }, "荔枝":{ "產(chǎn)地":["臺灣","云南","廣西"], "價格":[9,35,18] }, }, "蔬菜":{ "菜花":{ "產(chǎn)地":["河北","河南"], "價格":[25,13] }, "西紅柿":{ "產(chǎn)地":["懷柔","延慶"], "價格":[0.5,1] }, }, "調(diào)料":{ "醬油":{ "品牌":["海天","魯花","李錦記"], "價格":[25.5,35.5,15.5] }, "食用鹽":{ "品牌":["久大","白象"], "價格":[5,9] }, }, } while True: for i in data: print(i) choice = input("選擇進(jìn)入1>>:") if choice in data: while True: for i2 in data[choice]: print("\t",i2) choice2 = input("輸入b返回上一級菜單或選擇進(jìn)入2>>:") if choice2 in data[choice]: while True: for i3 in data[choice][choice2]: print("\t\t",i3) choice3 = input("輸入b返回上一級菜單或選擇進(jìn)入3>>:") if choice3 in data[choice][choice2]: for i4 in data[choice][choice2][choice3]: print("\t\t",i4) choice4 = input("輸入b返回上一層,或輸入q退出>>:") if choice4 == "b": pass elif choice4 == "q": exit() if choice3 == "b": break elif choice3 == "q": exit() if choice2 == "b": break elif choice2 == "q": exit() else: print("輸入內(nèi)容不存在。") break
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。