diff --git a/fib.py b/fib.py index 421cfab..ca108ca 100644 --- a/fib.py +++ b/fib.py @@ -1,15 +1,9 @@ - -""" -Fibonacci number generator -When given a position, the function returns the fibonacci at that position in the sequence. -The zeroth number in the fibonacci sequence is 0. The first number is 1 -Negative numbers should return None -""" def fibonacci(position): - if(position == 1 or position == 2): - return 1 - return fibonacci(position - 1) + fibonacci(position - 2) - - - - + if position < 0: + return None + elif position == 0: + return 0 + elif position == 1: + return 1 + else: + return fibonacci(position - 1) + fibonacci(position - 2) \ No newline at end of file diff --git a/github-assignment-python b/github-assignment-python new file mode 160000 index 0000000..5edddab --- /dev/null +++ b/github-assignment-python @@ -0,0 +1 @@ +Subproject commit 5edddab4a2c1df062ae1e50efb3411d6bc105efb diff --git a/hw2repo b/hw2repo new file mode 160000 index 0000000..a9a8041 --- /dev/null +++ b/hw2repo @@ -0,0 +1 @@ +Subproject commit a9a80417d485367af5b8bf9b923f7c07ee3562c8