From 16758d26d8e2108694c698465c8a0dbe7e9a6d01 Mon Sep 17 00:00:00 2001 From: Jordan Kubista Date: Mon, 16 Nov 2020 15:04:48 -0600 Subject: [PATCH 1/2] completed the activity with all tests passing was unsure about the very last bit 'getting above code to run' --- main.py | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 59325b9..ccbbff1 100644 --- a/main.py +++ b/main.py @@ -3,38 +3,63 @@ except for '+' and '-'. """ -__author__ = "???" +__author__ = "Jordan Kubista" def add(x, y): """Add two integers.""" - # your code here - return + sum_equals = x + y + return sum_equals def multiply(x, y): """Multiply x with y using the add() function above.""" - # your code here - return + product = 0 + for i in range(1, abs(y)+1): + + product = add(product, abs(x)) + + if x > 0 and y > 0 or x < 0 and y < 0: + return product + else: + return -product def power(x, n): """Raise x to power n, where n >= 0, using the functions above.""" - # your code here - return + power_of = 1 + + for i in range(1, n + 1): + power_of = multiply(power_of, x) + + return power_of def factorial(x): """Compute the factorial of x, where x > 0, using the functions above.""" - # your code here - return + factorial_of = x + + if x < 2: + return 1 + else: + for i in range(x - 1, 0, -1): + + factorial_of = multiply(factorial_of, i) + + return factorial_of def fibonacci(n): """Compute the nth term of fibonacci sequence using the functions above.""" - # your code here - return + fib_seq = [0, 1] + + for i in range(n): + fib_seq.append(add(fib_seq[-1], fib_seq[-2])) + print(fib_seq) + return fib_seq[n] + +print(fibonacci(11)) if __name__ == '__main__': # your code to call functions above From dd5ed26826a478c64cda879d0a890ec88459691c Mon Sep 17 00:00:00 2001 From: Jordan Kubista Date: Mon, 7 Dec 2020 12:39:35 -0600 Subject: [PATCH 2/2] testing ssh --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index ccbbff1..cc5472f 100644 --- a/main.py +++ b/main.py @@ -64,3 +64,5 @@ def fibonacci(n): if __name__ == '__main__': # your code to call functions above pass + +# testing ssh key \ No newline at end of file