Skip to content
Advertisement

I don’t get a print result of function when using range

Why can’t I see the result of the function when I use range()? I want to create a range of numbers where each the number will be evaluate in “colla” function. But range doesn’t work with “colla”

JavaScript

Advertisement

Answer

Your colla() function requires input numbers of 2 and above.

Try this:

JavaScript

Please be aware that calling colla(0) will result in an infinite loop, or rather “out of memory” when fin fills up with 0s. Also calling colla(1) results in a ZeroDivisionError because fin will be an empty list.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement