Summary of Sequences

In class today I we went over the Sequences chapter.

You can see a recording of the class here

Here is the notebook I used in class: sequences.ipynb

We started with the quiz which was won by Vincent

During the quiz we spent some time looking at this function which is defined recursively:

def get_sequence(n):
    """
    ...
    """
    if n == 4:
        return 1
    if n in [1, 2, 3]:
        return n
    return get_sequence(n - 2) + get_sequence(n - 1)

During the discussion about what get_sequence(n=7) gives I drew the following on the board:

If we work back from the end points of that image we get:

Which in turn gives:

Which in turn gives:

Which in turn gives:

Source code: @drvinceknight Powered by: Jekyll Github pages Bootsrap css