You will write the income and the return of a holding, then use them to judge a switch from one share to another.
Your tasks.
income, return the number of shares times the rate of dividend (as a fraction) times the face value.return_percent, return the income divided by the investment, times .switch, sell the old shares at sell_price, buy as many new shares as the money allows, and return the new income minus the old income.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…