Mortgage Function Extension and Data Processing

How can we extend the mortgage function to return a dictionary of address:mortgage?

Provide three separate dictionaries, filtered the same way as 'miniMortgages', 'standardMortgages', and 'jumboMortgages'?

Modify one value in the jumboMortgages dictionary. Check the original dict; did it remain intact or change? Why?

Extract the lists of amounts from each separate dictionary. Modify one value in the miniMortgages list. Does the miniMortgages dict change? How about the original dict? Why?

Base on the previous code, create a dictionary of address keys and the following tuple as value: (amount, rate, term in months). How to perform additional operations based on this new data?

Mortgage Function Extension and Data Processing

To extend the mortgage function and process the data, we need to follow certain steps:

  • Create separate dictionaries like 'miniMortgages', 'standardMortgages', and 'jumboMortgages' filtered based on mortgage amounts.
  • Modify one value in the jumboMortgages dictionary. Check if the original dict remains intact.
  • Extract amounts from each dictionary and modify one value in the miniMortgages list.
  • Create a dictionary with address keys and tuples of (amount, rate, term) as values.

Extending the Mortgage Function and Processing Data

To extend the mortgage function and process the data effectively, we can follow these steps:

1. Filtering Dictionaries:

First, create new dictionaries like 'miniMortgages', 'standardMortgages', and 'jumboMortgages' to store mortgages based on amount ranges.

Iterate through the original dictionary and add addresses with amounts below 200 to 'miniMortgages', between 200 and 467 to 'standardMortgages', and above 467 to 'jumboMortgages'.

2. Modifying Jumbo Mortgages:

Modify one value in the 'jumboMortgages' dictionary to observe changes.

The original 'jumboMortgages' dictionary will remain intact because dictionaries are mutable.

3. Modifying Mini Mortgages:

Extract amounts from each separate dictionary and modify one value in the 'miniMortgages' list.

The 'miniMortgages' dictionary should not change as modifying the list does not affect the original dictionary.

4. Creating New Dictionary:

Create a dictionary with address keys and tuples of (amount, rate, term) as values, ensuring amounts are between 100,000 and 1,000,000.

Perform additional operations like extracting and sorting tuples, calculating weighted average rate and maturity, and creating new dictionaries based on the original data.

← Interesting facts about standards in the vdv industry How to check if a key exists in a dictionary in python →