# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3 (Anaconda 5)
#     language: python
#     name: anaconda5
# ---

# # Critique
# #### Review of Monica's sequences code by <NAME>

# +
# #!/usr/bin/env python3
# -*- coding: utf-8 -*-


def fibonacci(n):
    """ returns the sequence of n fibonacci numbers
    """
    firstfib = 1
    secondfib = 1
    temp = 0
    seq = []
    for i in range (n):
        seq.append(firstfib)
        temp = secondfib + firstfib
        firstfib = secondfib
        secondfib = temp
    return seq
    


# +
# #!/usr/bin/env python3
# -*- coding: utf-8 -*-

import fib
import io
import contextlib

"""fib.py Test Module

Verify correct functionality of Fibonacci module.
"""

def test_fib_eighth():
    """Test eight Fibonacci number.
    
    Note that this test highlights the convenience of defining a
    main function in a script file. Normally one would call this
    script from the command line via bash. Here we call it directly
    and redirect the output (stdout) to a string that we can test.
    """
    # First redirect stdout to a string
    out = io.StringIO()
    with contextlib.redirect_stdout(out):
        # then run the script with commandline argument "6"
        # note that argument 0 is always the program name itself
        fib.main(["./fib.py", "6"])
    # then check printed output in string, stripping newline characters
    assert out.getvalue().strip() == "8"

# -

# 1. Is it clear how the code is organized?
# 2. Is the code properly documented with both docstrings and supplementary comments according to industry standards? 
# 3. Can you follow the algorithm of the code, i.e., what it is doing, and how? Does the code work? (Try cloning the respository and running it yourself to make sure it runs correctly.) 
# 4. Do you see any suggestions for how to improve the code? 
# 5. Are the test cases in the test module run by the code automatically by Travis?
# 6. Do the tests verify correct functionality? On a scale of 0-100, the reviewer should rate the work produced by the reviewee
#
# Answers: 
# 1. The fibonacci method in the module by Monica works very well! The code is clearly organized well.
# 2. The module is not properly documetned with both docstrings and cupplemtory comments according to industry standards. It simply states what the return value is, without giving much explanation on how the code is run. However, Monica did summarize very well how the parameter plays a role in her comment. 
# 3. The algorithm is precise and easy to follow. The code works.
# 4. The tests work fine too! I would rate her work a solid 96/100
#



StarcoderdataJupyterScriptsDedupFiltered