Completed
Push — master ( d1f0a7...3b2ece )
by Edward
21:04 queued 05:38
created

run()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 2
rs 10
cc 1
1
import math
2
3
4
from st2actions.runners.pythonrunner import Action
5
6
7
class PascalRowAction(Action):
8
    def run(self, **kwargs):
9
        return PascalRowAction._compute_pascal_row(**kwargs)
10
11
    @staticmethod
12
    def _compute_pascal_row(row_index=0):
13
        return [math.factorial(row_index) / (math.factorial(i) * math.factorial(row_index - i))
14
                for i in range(row_index + 1)]
15