Fibonacci (optional)
Last updated
Last updated
This is an optional assignment and can be a little tricky. The Fibonacci sequence is an infinite sequence of numbers that starts with 0 and 1 and then adds the previous number with the current to get the next number.
This sequence has many real-world applications and is even a naturally occurring phenomenon in plants and animals. This assignment will not introduce you to any real-world applications but is a fun puzzle to solve that will allow you to flex your new loop-building muscles.
Fork the following repository and clone your copy (if you haven't already for this lesson).
Open fibonacci.py
in your text editor.
ask the user if they want to:
solve the selected option using loops. Each option lends itself more to a
certain loop type. It is your job to find out which one goes with which
the first 10 Fibonacci numbers are:
an efficient algorithm will require you to swap the values of two variables.
You can do this using a temporary variable. Since this is a bit tricky, I will
provide you with the part you will need.