Skip to content

Commit

Permalink
Wrote factorial function...fixed mixed parantheses bug
Browse files Browse the repository at this point in the history
  • Loading branch information
devxl committed Jan 24, 2019
1 parent 0f001e7 commit 649f1cd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions factorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@

def factorial(n):
# TODO Define your logic for factorial here
return # TODO!
fact = 0
if n == 1:
fact = 1
else:
fact = factorial(n-1) * n
return fact # TODO!


def test_factorial():
assert factorial(1) == 1
# TODO: add more


if __name__ == '__main__':
# This is a way to determine either file was "executed", so if it was
# imported (by e.g. pytest) as a library, we should not run code
# below
nconditions = raw_input("Please enter number of conditions: ")
norders = factorial(nconditions)
print("Number of possible trial orders: " + str(norders)
print("Number of possible trial orders: " + str(norders))

0 comments on commit 649f1cd

Please sign in to comment.