Problem

Consider the following codes that compute the Fibonacci sequence using two different methods: fib_recursive.py and fib_loop.py.

  1. Put these two functions in a folder named fib such that they can be imported as a Python package to your Python environment.
  2. Rewrite these scripts such that they are imported as Python packages without being executed, while the functions are called if the scripts are executed as standalone Python code.

Solution

Python

Comments