About this question

Portfolio Copy and Modification

Medium · Code Analysis · Quant Trader interview question · python, copy, data-structures, portfolio-management

You are developing a trading algorithm in Python and need to copy a portfolio object. The portfolio object contains a nested list representing positions in different assets. Consider the following code snippet: After executing this code, will portfolio_a be affected by the modification made to portfolio_b? In other words, will the number of AAPL shares in portfolio_a also change?