Skip to content

Instantly share code, notes, and snippets.

@ferrix
Last active November 27, 2015 14:35
Show Gist options
  • Save ferrix/2bff5ce67fad6d364b0f to your computer and use it in GitHub Desktop.
Save ferrix/2bff5ce67fad6d364b0f to your computer and use it in GitHub Desktop.
Anna mä jeesaan
def replace_with_closest_restaurant(restaurant, customer_location):
if not restaurant.isChain():
return restaurant
result = restaurant
for place in restaurant.chain.get_locations():
if place.distance(customer_location) < result.distance(customer_location):
result = place
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment