Question: i was asked to write pytest by myself But it fails. I would appreciate if you can help. def savings ByMonth(amount, interest rate, months): Given

def savings ByMonth(amount, interest rate, months): Given a monthly contribution amount (e.g., 100), the annual interest rate (e.g. 5) and the number of months (e.g., 6), returns a list with the savings amount for each month, including the initial amount as the first element, and the savings in the given month as the last element. ans = [amount] total = 0 while months> : total = (amount+total)*(1+interest rate/(100*12)) ans.append(total) months = months-1 eturn ans import pytest def test savingsByMonth 10: assert savingsByMonth(100, 5, 0) == (100) def test savingsByMonth 20: assert savingsByMonth (100, 5, 1) - pytest.approx[100, 100.41666) ======== FAILURES EEEEEEEE test_savingsByMonth_2_ def test_savingsByMonth_2(): assert savingsByMonth(100, 5, 1) == pytest. approx[100,100.41666) TypeError: function' object is not subscriptable Lab_04.py:60: TypeError mm 1 failed, 6 passed in 0.05 seconds
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
