From 325e5393df36cb19bc87742f86ecdad0049b5fb9 Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Thu, 27 Oct 2022 13:43:38 -0700 Subject: Add Patrice --- entries/patricebelleville/fib.py | 13 +++++++++++++ people.json | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 entries/patricebelleville/fib.py diff --git a/entries/patricebelleville/fib.py b/entries/patricebelleville/fib.py new file mode 100644 index 0000000..767ce11 --- /dev/null +++ b/entries/patricebelleville/fib.py @@ -0,0 +1,13 @@ +def fibonacci(n): + return fib_helper(n, 0, 1) + +def fib_helper(n, prev, curr): + # Base cases + if n < 0: + raise ValueError('Negative argument to fibonnaci') + if n == 0: + return prev + if n == 1: + return curr + return fib_helper(n-1, curr, prev + curr) + diff --git a/people.json b/people.json index d611699..a6ef1d5 100644 --- a/people.json +++ b/people.json @@ -255,6 +255,16 @@ } ] }, + { + "name": "Patrice Belleville", + "title": "Associate Professor of Teaching, Computer Science, UBC", + "entries": [ + { + "name": "fib", + "link": "./entries/patricebelleville/fib.py" + } + ] + }, { "github": "perryliao", "name": "Perry Liao", -- cgit v1.2.3-70-g09d2