Your question is Expected Loss in Python. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Tiger Analytics uses credit risk analytics to estimate potential portfolio losses. For each credit account, calculate its expected loss and return the total expected loss for the portfolio.
For an account, expected loss is defined as:
exposure * probability_of_default * loss_given_default
Implement expected_loss(portfolio), where portfolio is a list of dictionaries. Each dictionary contains:
exposure: Non-negative numeric outstanding exposureprobability_of_default: A probability between 0 and 1loss_given_default: A proportion between 0 and 1Return the sum of expected losses as a floating-point number. Do not round the result.
def expected_loss(portfolio):