level: beginner
why do i get error \"can\'t multiply sequence by non-int of type \'float\'\"?
def nestEgVariable(salary, save, growthRates):
Sav
In this line:
fund = fund * (1 + 0.01 * growthRates) + depositPerYear
growthRates is a sequence ([3,4,5,0,3]
). You can't multiply that sequence by a float (0.1). It looks like what you wanted to put there was i
.
Incidentally, i
is not a great name for that variable. Consider something more descriptive, like growthRate
or rate
.