Fibonacci (Number)

Objective

To implement a program that generates a Fibonacci sequence of given number of terms. 

 

Theory

The Fibonacci sequence is a mathematical concept where each number is the sum of the preceding two numbers, starting with 0 and 1. For example, the first ten numbers in the Fibonacci sequence are:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34

To write a program that generates the Fibonacci sequence, we need to define a function that takes an input parameter "n" (the number of elements we want to generate) and returns a list of the first "n" elements in the sequence.

 

Learning Outcomes 

  • Understanding of basic programming concepts: Learning to write a program that calculates the Fibonacci sequence can help individuals develop a deeper understanding of basic programming concepts such as variables, loops, and functions.
  • Development of problem-solving skills: Writing a program that generates the Fibonacci sequence requires breaking down the problem into smaller, more manageable steps. This can help individuals develop their problem-solving skills.
  • Improved logical thinking: Writing a program involves creating a logical sequence of steps that the computer can follow. This can help individuals improve their logical thinking skills.
  • Understanding of algorithms: The Fibonacci sequence is a classic example of a recursive algorithm. Writing a program to generate the sequence can help individuals better understand how algorithms work.
  • Practice with coding syntax: Writing a program involves using specific coding syntax and commands. Writing a Fibonacci program can help individuals practice and improve their coding skills.
  • The learner will be able to comprehend and implement conditional statements (if-elif-else) to control the flow of execution in a program. 
  • The learner will be capable of using loop structures (for loop) to iterate over a range of values and perform repetitive tasks in a program.