File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 88
99def factorial (n ):
1010 # TODO Define your logic for factorial here
11- return # TODO!
11+ fact = 0
12+ if n == 1 :
13+ fact = 1
14+ else :
15+ fact = factorial (n - 1 ) * n
16+ return fact # TODO!
17+
1218
1319def test_factorial ():
1420 assert factorial (1 ) == 1
1521 # TODO: add more
1622
23+
1724if __name__ == '__main__' :
1825 # This is a way to determine either file was "executed", so if it was
1926 # imported (by e.g. pytest) as a library, we should not run code
2027 # below
21- nconditions = raw_input ("Please enter number of conditions: " )
28+ nconditions = input ("Please enter number of conditions: " )
2229 norders = factorial (nconditions )
23- print ("Number of possible trial orders: " + str (norders )
30+ print ("Number of possible trial orders: " + str (norders ))
You can’t perform that action at this time.
0 commit comments