Python Forum
[split] help a brother am so new
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] help a brother am so new
#1
Hi there,

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'
Reply


Messages In This Thread
[split] help a brother am so new - by MohsinCoding - Feb-13-2020, 12:42 PM
RE: [split] help a brother am so new - by Larz60+ - Feb-13-2020, 06:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  help a brother am so new manimani 5 2,407 Feb-14-2020, 11:22 PM
Last Post: michael1789

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020