CSCI 151: Thanksgiving Break Homework
For short-term investors who plan to buy, fix up and sell their properties right away, usually the following the after-repair-value
formula is used:
purchase_price = 75% * (after_repair_value) - repair_expenses
In this formula, after_repair_value is the price that you can sell your home AFTER it is all fixed up.
Example:
You see an older home on the market that is visibly rundown and needs repair, and the current market price is:
$160,000 "as is." After you
assess the damage, you estimate it will require $25,000 repair expenses. Homes of the same size in the
neighborhood have been selling for $220,000 in "move-in, turn-key condition." You would need to buy the home for $140,000 to make it
a worthwhile investment. (75 percent of $220,000 = $165,000. $165,000 minus $25,000 = $140,000.)
Write the following functions.
- Write a
function
def purchase_price(ARV, repair_expenses) that has 2 parameters:
- ARV is after_repair_value, is the price that you can sell your home AFTER it is all fixed up
- repair_expenses - amount of dollars to repair the house
The function will use the
the formula written below to calculate the purchase price:
purchase_price = 75% * (after_repair_value) - repair_expenses
The function returns the purchase price
- Write a function def process(size), size is the number of houses the customer consider for purchasing.
The function reads
after_repair_value and repair_expenses for each house, and the current market price for the house.
The function then calls function purchase_price to calculate the price that investor should pay for the house to make it worthwhile
investment.
The function returns the number of houses that worthwhile investment and the number of houses that priced too high on the current
market. FOR TESTING PURPOSES, PRINT the purchasing price for EACH house
- Write main program that randomly generates the number of houses customer cosider for investment, assume that the
size is between 3 and 15 and call function
process to find the number of houses that worthwhile an investment and the number of houses that are priced too hight on the current
market.
- TEST YOUR PROGRAM and DOCUMENT TEST INPUT/OUTPUT values