Exercise 1

Fibonacci sequence

1, 1, 2, 3, 5, 8, ..... It starts with 1, 1. The n-th item FnF_n is given using the following equation:

Fn=Fn1+Fn2F_n = F_{n-1} + F_{n-2}

  • Initiate an empty repo;

  • Show all branches;

  • Define a function named fib() in a new file make_fibo.py

    • It takes an argument n and returns the first n items of the Fibonacci sequence (without using recursion).

    • Make a commit;

    • Show all branches;

  • Make a new branch called feature;

    • Show all branches;

  • Switch to the feature branch;

    • Show all branches;

    • Observe any difference from the previous one;

  • Add a new file called make_fibo_recur.py;

    • Implement the fib() using recursion;

    • Make a commit;

  • Switch to the master branch;

  • Rename the feature branch to new-branch;

    • Show all branches;

  • Try delete the new-branch;

    • Merge the new-branch into master;

    • Try delete the new-branch;

  • Show all branches;

Last updated