fact2()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 2
c 4
b 0
f 0
dl 0
loc 6
rs 9.4285
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
u"""
4
:author: Joseph Martinot-Lagarde
5
6
Created on Sat Jan 19 14:57:57 2013
7
"""
8
9
from __future__ import (
10
    print_function, division, unicode_literals, absolute_import)
11
12
13
@profile
14
def fact2(n):
15
    result = 1
16
    for i in xrange(2, n + 1):
17
        result *= i * 2
18
    return result
19
20
21
@profile
22
def sum2(n):
23
    result = 0
24
    for i in xrange(1, n + 1):
25
        result += i * 2
26
    return result
27
28
if __name__ == "__main__":
29
    print(fact2(120))
30
    print(sum2(120))
31