Reference no: EM133295413
Python
Extend the mortgage function to return a dict of address: mortgage. For simplicity, address should be a unique six-character string. For example {'867E23' : 120}.
Mortgage should range from 100 to 1,000 and do not need to all be unique.Filter the result of into three lists: Amounts below 200, amounts between 200 and 467, and amounts greater than 467. Call these 'miniMortgages', 'standardMortgages', and 'jumboMortgages' respectively.
a. Provide three separate dicts, filtered the same way as 'miniMortgages', 'standardMortgages', and 'jumboMortgages' .
b. Modify one value in the jumboMortgages dict. Check the original dict; did it remain intact or change? Why?
c. Extract the lists of amounts from each separate dict. Modify one value in the miniMortgages list. Does the miniMortgages dict change? How about the original dict? Why?
Base on previous code, create to be a dict of address keys and the following tuple as value: (amount, rate, term in months). Amount should now be between 100,000 and 1,000,000. Once you have done this, do the following:
a. Extract a list of tuple values from the dict, and sort the list by amount (descending).
b. Create a function that calculates the Weighted Average Rate of the mortgage pool. The input parameter should be a list of mortgage tuples (amount,rate,term). Print the rate percentage, rounded to the nearest hundredths.
c. Create a function that calculates the Weighted Average Maturity (term) of the mortgage pool. The input parameter should be a list of mortgage tuples (amount,rate,term).
d. Create a new dict (by processing the original dict) with Term as the key and a list of (amount, rate) tuples for each Term key.