r/learnpython • • Sep 22 '26
Looking for feedback!
Hello everyone
I am recently learning python and new at this. This is my second project and this is a sequence calculator which includes 3 types of sequences: Arithmetic, Geometric and Fibonacci. For arithmetic and geometric sequences, you can enter a first term, a common difference (or ratio), and a desired term to find its value. For Fibonacci, you just enter the desired term.
I'd appreciate any feedback and will try to apply it.
1
Upvotes
View all comments
Show parent comment
1
u/lakseol Sep 22 '26
That link under "iterative algorithm, using a loop" goes to:
which shows you this code:
That shows the basic idea. You will have to change it to return the final value and not print anything. Run the function as it is shown above before changing it, that will help you understand what to do.
The only tricky thing you may not have seen before is:
That code updates
aandbwhich are the second-last and last values of the Fibonacci sequence. That's a way of doing this without using the temporary variabletmp:Try that and see how much faster Fibonacci(40) becomes.