Completed
Push — master ( fe66bc...2a24eb )
by Manas
18:11
created

PrimeChecker   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 14
Duplicated Lines 0 %
Metric Value
wmc 6
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fib() 0 4 2
1
import math
2
3
4
class PrimeChecker(object):
5
6
    def __init__(self, config=None):
7
        pass
8
9
    def run(self, value=0):
10
        if math.floor(value) != value:
11
            raise ValueError('%s should be an integer.' % value)
12
        if value < 2:
13
            return False
14
        for test in range(2, int(math.floor(math.sqrt(value)))+1):
15
            if value % test == 0:
16
                return False
17
        return True
18
19
if __name__ == '__main__':
20
    checker = PrimeChecker()
21
    for i in range(0, 10):
22
        print '%s : %s' % (i, checker.run(**{'value': i}))
23