diff options
-rw-r--r-- | entries/funemy/symbolic/phib.py | 21 | ||||
-rw-r--r-- | people.json | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/entries/funemy/symbolic/phib.py b/entries/funemy/symbolic/phib.py new file mode 100644 index 0000000..c6fb23e --- /dev/null +++ b/entries/funemy/symbolic/phib.py @@ -0,0 +1,21 @@ +from typing import List + +def phib(xs: List[int]) -> bool: + """ + Instructions: + 1. `pip install crosshair-tool` + 2. modify the precondition `pre` to control the length of your fib sequence + 3. run `crosshair check phib.py` in your terminal + + pre: len(xs) >= 10 + post: __return__ != True + """ + if xs[0] != 0: + return False + if len(xs) > 1: + if xs[1] != 1: + return False + for i in range(2,len(xs)): + if xs[i] != xs[i-1] + xs[i-2]: + return False + return True diff --git a/people.json b/people.json index a6e6686..6499425 100644 --- a/people.json +++ b/people.json @@ -68,6 +68,10 @@ { "name": "z3", "link": "./entries/funemy/z3/z3fib.sh" + }, + { + "name": "symbolic", + "link": "./entries/funemy/symbolic/phib.py" } ] }, |