Last active
August 29, 2015 14:00
-
-
Save ageitgey/dff649d83fc2799b4b31 to your computer and use it in GitHub Desktop.
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 estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood): | |
price = 0 | |
# In my area, the average house costs $200 per sqft | |
price_per_sqft = 200 | |
if neighborhood == "hipsterton": | |
# some areas cost a bit more | |
price_per_sqft = 400 | |
elif neighborhood == "skid row": | |
# some areas cost less | |
price_per_sqft = 100 | |
# start with a price estimate based on how big the place is | |
price = price_per_sqft * sqft | |
# adjust our estimate based on the number of bedrooms | |
if num_of_bedrooms == 0: | |
# Studio apartment is cheap | |
price = price - 20000 | |
else: | |
# places with more bedrooms are usually | |
# more valuable | |
price = price + (num_of_bedrooms * 5000) | |
return price |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment