level: beginner
why do i get error \"can\'t multiply sequence by non-int of type \'float\'\"?
def nestEgVariable(salary, save, growthRates):
Sav
Python allows for you to multiply sequences to repeat their values. Here is a visual example:
>>> [1] * 5
[1, 1, 1, 1, 1]
But it does not allow you to do it with floating point numbers:
>>> [1] * 5.1
Traceback (most recent call last):
File "", line 1, in
TypeError: can't multiply sequence by non-int of type 'float'