Feb-13-2020, 12:42 PM
Hi there,
I am new with Python and would like anyone to help me with the following code:
1
1
I am new with Python and would like anyone to help me with the following code:
fibLimit= eval(input('Enter how many Fibonacci numbers you would like to print = ')) fbNext= [None] * int(fibLimit) fbNext[0] = 1 fbNext[1] = 1 for i in range(len(fbNext)): if i < 2: print(fbNext[i]) else: nex = fbNext[i] + fbNext[i - 1] print(nex)Enter how many Fibonacci numbers you would like to print = 5
1
1
Error:Traceback (most recent call last):
File "D:My Python Code\CHP2.py", line 40, in <module>
nex = fbNext[i] + fbNext[i - 1]
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'