For different `interest_rates`

, I am trying to plot how 100 dollars will grow in 10 years.

I have manged to do it in Python. Using similar approch, I have tried to do it in R. Unfortunately , line plots appear three separate graphs. Below are my attempts.

**Python**

```
import numpy as np
import matplotlib.pyplot as plt
interest_rates = [.12, .15, .2]
years = 10
amount = np.empty(years + 1)
for i in interest_rates:
amount[0] = 100
for year in range(years):
amount[year + 1] = amount[year]*(1 + i)
plt.plot(amount, label = f'$\\alpha = {i}$')
plt.legend()
plt.show()
```

**R**

```
interest_rates <- c(.12, .15, .2)
years <- 10
amount <- vector("double", years + 1)
for (i in interest_rates){
amount[1] <- 100
for (year in seq(years)){
amount[year + 1] = amount[year] * (1 + i)
}
plot(amount, type = "line")
}
#> Warning in plot.xy(xy, type, ...): plot type 'line' will be truncated to first
#> character
```

```
#> Warning in plot.xy(xy, type, ...): plot type 'line' will be truncated to first
#> character
```

```
#> Warning in plot.xy(xy, type, ...): plot type 'line' will be truncated to first
#> character
```

^{Created on 2021-08-14 by the reprex package (v2.0.0)}