Assignments for the first week of Python automated development and learning --- Level 3 menu,

Source: Internet
Author: User

Assignments for the first week of Python automated development and learning --- Level 3 menu,

Job Requirements:
(1) run the program to output the first menu
(2) Select a level-1 menu and output level-2 menus. Similarly, level-3 menus are output.
(3) enable the user to select whether to exit
(4) The function of returning the top menu

1 data = {2 "Tianjin": {3 "Nankai district": {4 "Nankai University": {5 "History Department" :{}, 6 "Literature Department ":{}, 7 "English Department" :{}, 8 }, 9 "Emy of Science and Technology": {10 "computer department" :{}, 11" ":{}, 12 "software department" :{}, 13 }, 14 "Emy of technology": {15 "Department of mathematics" :{}, 16 "Department of Chemistry" :{}, 17 "Department of Physics ": {}, 18}, 19}, 20 "Wuqing district": {21 "Wuqing University": {22 "History Department" :{}, 23 "Literature Department ":{}, 24 "English Department" :{}, 25 }, 26 "Wuqing University of Science and Technology": {27 "computer department" :{}, 28 "machine Department ":{}, 29 "software department": {}, 30 }, 31 "Wuqing University of Technology": {32 "Department of mathematics" :{}, 33 "Department of Chemistry ":{}, 34 "Physics Department" :{}, 35 }, 36 }, 37 "Beichen District": {38 "Beichen University": {39 "History Department" :{}, 40 "Literature Department ": {}, 41 "English Department" :{}, 42 }, 43 "beechen University of Science and Technology": {44 "computer department" :{}, 45 "machine Department ":{}, 46 "software department" :{}, 47 }, 48 "beechen University of Technology": {49 "Mathematics Department" :{}, 50 "Department of Chemistry ":{}, 51 "Physics Department" :{}, 52 }, 53 }, 54 }, 55 "Hebei": {56 "baoding city": {57 "Baoding University ": {58 "History Department" :{}, 59 "Literature Department" :{}, 60 "English Department" :{}, 61 }, 62 "Baoding University of Science and Technology ": {63 "Computer System" :{}, 64 "Computer System" :{}, 65 "Software System" :{}, 66 }, 67 "Baoding University of Technology ": {68 "Mathematics Department" :{}, 69 "Chemistry Department" :{}, 70 "Physics Department" :{}, 71 }, 72 }, 73 "Qinhuangdao ": {74 "Qinhuangdao University": {75 "History Department" :{}, 76 "Literature Department" :{}, 77 "English Department" :{}, 78 }, 79 "Qinhuangdao University of Science and Technology": {80 "computer department" :{}, 81 "machine Department" :{}, 82 "software department" :{}, 83 }, 84 "Qinhuangdao University of Technology": {85 "Department of mathematics" :{}, 86 "Department of Chemistry" :{}, 87 "Department of Physics" :{}, 88 }, 89 }, 90 "Shijiazhuang": {91 "Shijiazhuang University": {92 "History Department" :{}, 93 "Literature Department" :{}, 94 "English Department" :{}, 95 }, 96 "Shijiazhuang University of Science and Technology": {97 "computer department" :{}, 98 "machine Department" :{}, 99 "software department" :{}, 100 }, 101 "Shijiazhuang University of Technology": {102 "Department of mathematics" :{}, 103 "Department of Chemistry" :{}, 104 "Department of Physics" :{}, 105 }, 106 }, 107}, 108 "Henan": {109 "Zhengzhou City": {110 "Zhengzhou University": {111 "History Department" :{}, 112 "Literature Department ":{}, 113 "English Department" :{}, 114 }, 115 "Zhengzhou University of Science and Technology": {116 "computer department" :{}, 117 "machine Department ":{}, 118 "software department" :{}, 119 }, 120 "Zhengzhou University of Technology": {121 "Department of mathematics" :{}, 122 "Department of Chemistry ":{}, 123 "Physics Department" :{}, 124 }, 125 }, 126 "Nanyang City": {127 "Nanyang University": {128 "History Department" :{}, 129 "Literature Department ": {}, 130 "English Department" :{}, 131 }, 132 "Nanyang University of Science and Technology": {133 "computer department" :{}, 134 "machine Department ":{}, 135 "software department" :{}, 136 }, 137 "Nanyang University of Technology": {138 "Mathematics Department" :{}, 139 "Department of Chemistry ":{}, 140 "Physics Department" :{}, 141 }, 142 }, 143 "DengFeng city": {144 "Dengfeng University": {145 "History Department" :{}, 146 "Literature Department ": {}, 147 "English Department" :{}, 148 }, 149 "Dengfeng University of Science and Technology": {150 "computer department" :{}, 151 "machine Department ":{}, 152 "software department" :{}, 153 }, 154 "Dengfeng Polytechnic University": {155 "Mathematics Department" :{}, 156 "Department of Chemistry ":{}, 157 "Physics Department": {}, 158}, 159}, 160}, 161} 162 # exit_flag = False163 while True: 164 for I in data: 165 print (I) 166 choice = input ("input:") 167 if choice in data: 168 while True: 169 for i2 in data [choice]: 170 print (i2) 171 choice2 = input ("input2:") 172 if choice2 in data [choice]: 173 while True: 174 for i3 in data [choice] [choice2]: 175 print (i3) 176 choice3 = input ("input3:") 177 if choice3 in data [choice] [choice2]: 178 for i4 in data [choice] [choice2] [choice3]: 179 print (i4) 180 choice4 = input ("Press B to return to the previous level:") 181 if choice4 = "B ": 182 pass183 elif choice4 = "q": 184 exit () 185 if choice3 = "B": 186 break187 elif choice3 = "q": 188 exit () 189 if choice2 = "B": 190 break191 elif choice2 = "q": 192 exit ()
View Code

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.