def boot(): admin = input("Are you an administrator? y/n") if admin.lower() == 'y': print(vc_metro.keys()) add_station = input('Add a construction site from the list: ') if add_station in vc_metro.keys(): stations_under_construction.append(add_station) else: print('please enter a valid station or exit by typing "n".') boot()
def add_maintenance(station_to_add): if station_to_add in vc_metro.keys(): if station_to_add not in stations_under_construction: stations_under_construction.append(station_to_add) print(stations_under_construction) else: print("Invalid station")
def admin_console(): choice = input("Enter 'a' to add station to maintenance list, 'b' to remove station from maintenance list, 'c' to view maintenance list, or 'q' to quit: ") while choice not in ['a', 'b', 'c', 'q']: choice = input("Enter 'a', 'b' or 'c': ") if choice == 'a': station_under_construction = input("Enter station name: ") while station_under_construction not in vc_metro.keys() and station_under_construction != 'q': station_under_construction = input("Station not found. Try again: ") if station_under_construction == 'q': print("Leaving admin console. \n") return stations_under_construction.append(station_under_construction) print("{0} added to maintenance list.\n".format(station_under_construction)) elif choice == 'b': print("The following stations are closed for maintenance:\n") for station in stations_under_construction: print(station) station_reopened = input("\nEnter station to remove from list: ") while station_reopened not in vc_metro.keys() and station_reopened not in stations_under_construction and station_reopened != 'q': station_reopened = input("Station not found. Try again: ") if station_reopened == 'q': print("Leaving admin console. \n") return stations_under_construction.remove(station_reopened) print("{0} removed from maintenance list.\n".format(station_reopened)) elif choice == 'c': if stations_under_construction: print("The following stations are closed for maintenance:\n") for station in stations_under_construction: print(station) else: print("There are no stations closed for maintenance.\n") elif choice == 'q': print("Leaving admin console. \n") return again = input("Would you like to add or remove any more stations? (y/n): ") while again not in ['y', 'n']: again = input("Enter 'y' or 'n': ") if again == 'y': admin_console() if again == 'n': return
def rem_maintenance(station_to_remove): if station_to_remove in vc_metro.keys(): if station_to_remove in stations_under_construction: stations_under_construction.remove(station_to_remove) print(stations_under_construction) else: print("Station not listed undergoing maintenance.") else: print("Invalid station")
def get_active_stations(): updated_metro = vc_metro for station_under_construction in stations_under_construction: for current_station in vc_metro.keys(): if current_station != station_under_construction: updated_metro[current_station] -= set(stations_under_construction) else: updated_metro[current_station] = set([]) return updated_metro
def employee_update(): is_employee = input('Are you an employee looking to update a station under construction? Enter y/n: ') break_flag = False while break_flag == False: if is_employee == 'y': id = str(input('Please enter your employee id: ')) else: return if id in employee_ids: while True: station = input('Please enter the station that is under construction: ') if station not in stations_under_construction and station in vc_metro.keys(): stations_under_construction.append(station) elif station not in vc_metro.keys(): print('This station is not in the Vancouver system') again = input("Would you like to enter another station? Enter y/n: ") if again == 'n': print('Thanks for the update!') break_flag = True break else: try_again = input('This is not a valid employee id. Do you still want to update a station under construction? Enter y/n: ') if try_again != 'y': break
for letter, landmark in landmark_choices.items(): landmark_string += "{0} - {1}\n".format(letter, landmark) stations_under_construction = [ 'Bridgeport', 'King Edward', 'Broadway-City Hall', 'Vancouver City Centre' ] stations_uc_dict = { i: stations_under_construction[i] for i in range(len(stations_under_construction)) } stations_uc_string = "" for num, station in stations_uc_dict.items(): stations_uc_string += "{0} - {1}\n".format(num, station) station_list = [] station_list += vc_metro.keys() station_dict = {i: station_list[i] for i in range(len(station_list))} station_string = "" for num, station in station_dict.items(): station_string += "{0} - {1}\n".format(num, station) def maintenance_greet(): print( "Hi, this is where you update the list of stations under construction. For maintenance crew only!\n" ) def choose_action():