Last active
November 27, 2015 14:35
-
-
Save ferrix/2bff5ce67fad6d364b0f to your computer and use it in GitHub Desktop.
Anna mä jeesaan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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