Portfolio Project: Restaurant Recommendation

Hello trying to finish up my final project for this section and for some reason the program will not run after you have made choices.
I restructured an old assignment to work better with this but I feel like I am missing something else in the rest_recomm.py code. The import pages look all fine but I know I did something wrong.
Could someone please take a look at my code and see where I went wrong,
Here is a link to the GitHub : GitHub - kempth/restuarantrecommendations.

Here is the actual code to the rest_comm.py:
from graph_search import bfs, dfs
from food_type import food_type
from restaurant_type import restaurant_type
from restaurant_choices import restaurant_choices

Build your program below:

choices_string = “”
restaurant_under_construction =

for letter, choices in restaurant_choices.items():
choices_string += letter + “-” + choices + “\n”

def greet():
print(“Hi there and welcome to Restaurant Recommendation”)
print(“We’ll help you find the best Restaurant from the following choices:\n” + choices_string)

def rest_recomm():
greet()
new_route()
goodbye()

def get_start():
start_point_letter = input("Which meal of the day do you want? Type in the corresponding letter A-C: ")
if start_point_letter in restaurant_choices:
start_point = restaurant_choices[start_point_letter]
return start_point
else:
print(“Sorry, that’s not a choice we have data on. Let’s try this again…”)
return get_start()

def get_end():
end_point_letter = input("Ok, what type of cuisine would you like? Type in the corresponding number 1-5: ")
if end_point_letter in restaurant_choices:
end_point = restaurant_choices[end_point_letter]
return end_point
else:
print(“Sorry, that’s not a choice we have data on. Let’s try this again…”)
return get_end()

def set_start_and_end(start_point, end_point):
if start_point is not None:
change_point = input("What would you like to change? You can enter ‘t’ for ‘time of meal’, ‘c’ for ‘cuisine’, or ‘b’ for ‘both’: ")
if change_point == “b”:
start_point = get_start()
end_point = get_end()
elif change_point == “t”:
start_point = get_start()
elif change_point == “c”:
end_point = get_end()
else:
print(“Oops, that isn’t ‘t’, ‘c’, or ‘b’…”)
set_start_and_end(start_point, end_point)

else:
start_point = get_start()
end_point = get_end()

return start_point, end_point

def show_choices():
see_choices = input("Would you like to see the list of choices again? Enter y/n: ")
if see_choices == “y”:
print(choices_string)

def new_route(start_point=None, end_point=None):
start_point, end_point = set_start_and_end(start_point, end_point)
shortest_route = get_route(start_point, end_point)
if shortest_route is not None:
shortest_route_string = “\n”.join(shortest_route)
print(“The options available from {0} to {1} is:\n{2}”.format(start_point, end_point, shortest_route_string))
else:
print(“Unfortunately, there is currently no options between {0} and {1} due to maintenance.”.format(start_point, end_point))
again = input("Would you like to see other options? Enter y/n: ")
if again == “y”:
show_choices()
new_route(start_point, end_point)

def get_route(start_point, end_point):
start_stations = restaurant_type[start_point]
end_stations = restaurant_type[end_point]
routes =

for start_station in start_stations:
for end_station in end_stations:
metro_system = get_active_stations() if restaurant_under_construction else food_type
if len(restaurant_under_construction) > 0:
possible_route = dfs(metro_system, start_station, end_station)
if not possible_route:
return None

  route = bfs(metro_system, start_station, end_station)
  if route is not None:
    routes.append(route)

shortest_route = min(routes, key=len)
return shortest_route

def get_active_stations():
updated_metro = food_type

for station_under_construction in restaurant_under_construction:
for current_station, neighboring_stations in food_type.items():
if current_station != station_under_construction:
updated_metro[current_station] -= set(restaurant_under_construction)
else:
updated_metro[current_station] = set()
return updated_metro

def goodbye():
print(“Thanks for using Restaurant Recommendation!”)

#print(get_route(“Marine Building”, “Robson Square”))

#print(set_start_and_end(None, None))
rest_recomm()

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.