Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pytest_cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# pytest cache directory #

This directory contains data from the pytest's cache plugin,
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.

**Do not** commit this to version control.

See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information.
1 change: 1 addition & 0 deletions .pytest_cache/v/cache/lastfailed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions .pytest_cache/v/cache/nodeids
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
"factorial.py::test_factorial"
]
Binary file added __pycache__/factorial.cpython-36-PYTEST.pyc
Binary file not shown.
17 changes: 11 additions & 6 deletions factorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@


def factorial(n):
# TODO Define your logic for factorial here
return # TODO!
prod = 1
for i in range(n):
prod = prod * (n - i)
return prod


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


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)
nconditions = input("Please enter number of conditions: ")
norders = factorial(int(nconditions))
print("Number of possible trial orders: " + str(norders))