diff options
author | Braxton Hall | 2022-10-27 20:50:22 +0000 |
---|---|---|
committer | GitHub | 2022-10-27 20:50:22 +0000 |
commit | 2310fb9265692aee5b06e2f35830b8ceca193073 (patch) | |
tree | 76026fb0788b0571c6080679fb23ddbec7d2be32 | |
parent | eea4d18a2ef4cfe4e5f4d4a302b6ef452dec18b7 (diff) | |
parent | 325e5393df36cb19bc87742f86ecdad0049b5fb9 (diff) |
Merge pull request #59 from braxtonhall/patrice
Add Patrice Belleville
-rw-r--r-- | entries/patricebelleville/fib.py | 13 | ||||
-rw-r--r-- | people.json | 10 |
2 files changed, 23 insertions, 0 deletions
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 @@ -256,6 +256,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", "title": "BSc, UBC", |