Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigoula committed Mar 7, 2024
1 parent cf58715 commit 02acb83
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
7 changes: 3 additions & 4 deletions ukp_template_workshop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from .base import BaseClass
##### YOUR CODE HERE #####
from .fibonacci import Fibonacci

##########################

__all__ = [
"BaseClass",
##### YOUR CODE HERE #####

"Fibonacci"
##########################
]
]
13 changes: 11 additions & 2 deletions ukp_template_workshop/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
- Import things from your .base module
"""
##### YOUR CODE HERE #####

import argparse
from ukp_template_workshop import Fibonacci
##########################

def main(): # pragma: no cover

"""
The main function executes on commands:
`python -m ukp_template_workshop` and `$ ukp_template_workshop `.
Expand All @@ -28,5 +30,12 @@ def main(): # pragma: no cover
* Run an application (Flask, FastAPI, Django, etc.)
"""
##### YOUR CODE HERE #####
print("This will do something")

parser = argparse.ArgumentParser()
parser.add_argument("n", type=int)

args = parser.parse_args()

answer = Fibonacci(args.n)
print("Answer:", answer)
##########################
8 changes: 5 additions & 3 deletions ukp_template_workshop/fibonacci.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ def __init__(self):
self.mem = {}

def fib(self, n: int) -> int:
##### YOUR CODE HERE #####
return 0
##########################
# fib(n) = fib(n-1) + fib(n-2)
if n in (1, 2):
return 1
else:
return self.fib(n-1) + self.fib(n-2)

0 comments on commit 02acb83

Please sign in to comment.