MCPcopy Create free account
hub / github.com/geekcomputers/Python / search

Function search

Hotel-Management.py:166–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164
165
166def search():
167 with open("Management.txt") as File:
168 dictionary = json.loads(File.read().replace("'", '"'))
169
170 dict_num = dictionary.get("Room")
171 dict_len = len(dict_num)
172
173 if dict_len == 0:
174 print("\nThere is no data in our database\n")
175 menu()
176 else:
177 Room = input("\nEnter your Room Number: ")
178
179 listt_num = dictionary.get("Room")
180 index = int(listt_num.index(Room))
181
182 listt_fname = dictionary.get("First_Name")
183 listt_lname = dictionary.get("Last_Name")
184 listt_phone = dictionary.get("Phone_num")
185 listt_type = dictionary.get("Room_Type")
186 listt_days = dictionary.get("Days")
187 listt_price = dictionary.get("Price")
188
189 print(f"\nFirst Name: {listt_fname[index]}")
190 print(f"Last Name: {listt_lname[index]}")
191 print(f"Phone number: {listt_phone[index]}")
192 print(f"Room Type: {listt_type[index]}")
193 print(f"Days staying: {listt_days[index]}")
194 print(f"Money paid: {listt_price[index]}")
195 print(f"Room Number: {listt_num[index]}")
196
197 exit_menu()
198
199
200def remove():

Callers 1

menuFunction · 0.70

Calls 4

menuFunction · 0.85
exit_menuFunction · 0.85
getMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected