There are many issues with your code. And you should first learn and try as much as you can on your own. I am also a beginner so I know what you are thinking.
For some quick edits to make it workable:
n1 = 0
n2 = 1
n3 = 0
for i in range(10):
n3 = n1 + n3
print(n3)
n1 = n2
n2 = n3
- The series starts with 0, you initialized it with 1.
- The update statement
n3=n1+n2
is outside the loop, how will it update? What is happening here isn3 = 1 + 1 = 2
in your code stays the same and it doesn’t change.
0
solved Fibonacci in Python – Simple solution [duplicate]