question archive 2) Let's use a while-loop to perform the most basic type of compound—interest calculation
Subject:Computer SciencePrice: Bought3
2) Let's use a while-loop to perform the most basic type of compound—interest calculation. Suppose you start with $1,000 as your principal and that each year you accumulate 10% in interest. Then, after the ?rst year, you would have $1,100 (since 100 is 10% of 1000). The next year you would add 10% of $1,100 to $1,100. What we'd like to know is: how many years does it take for this compounding process to reach a desired target of $10,000? Write code below to perform this calculation: def compute_nu.m_years(annual_rate, principal, target): # Write your code here n = compute_num_years(10, 1000, 10000) print( 'num years =' , n) # Should print 25 n = c0mpute_num_years(8, 1000, 10000) print('nu.m years = , n) # Should print 30 Write your code in my_compound_interest .py.