-
Notifications
You must be signed in to change notification settings - Fork 0
/
filters.py
79 lines (70 loc) · 1.99 KB
/
filters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""This module will hold filters"""
default_tens = ((0,5),
(0,5),
(0,5),
(0,5),
(0,5),
)
def even_numbers(comb, min = 0, max = 5):
even = 0
for i in comb[0]:
if (int(i) % 2) == 0:
even +=1
return ((even >= min) and (even <= max))
def odd_numbers(comb, min = 0, max = 5):
odd = 0
for i in comb[0]:
if (int(i) % 2) != 0:
odd += 1
return ((odd >= min) and (odd <= max))
def even_stars(comb, min = 0, max = 2):
even = 0
for i in comb[1]:
if (int(i) % 2) == 0:
even +=1
return ((even >= min) and (even <= max))
def odd_stars(comb, min = 0, max = 2):
odd = 0
for i in comb[1]:
if (int(i) % 2) != 0:
odd += 1
return ((odd >= min) and (odd <= max))
def high_numbers(comb, min = 0, max = 5):
""" A number is high if >= 25"""
high = 0
for i in comb[0]:
if int(i) >= 25:
high += 1
return ((high >= min) and (high <= max))
def low_numbers(comb, min = 0, max = 5):
""" A number is low if <= 25"""
low = 0
for i in comb[0]:
if int(i) >= 25:
low += 1
return ((low >= min) and (low <= max))
def high_stars(comb, min = 0, max = 2):
""" A number is high if >= 5"""
high = 0
for i in comb[1]:
if int(i) >= 5:
high += 1
return ((high >= min) and (high <= max))
def low_stars(comb, min = 0, max = 2):
""" A number is low if <= 5"""
low = 0
for i in comb[1]:
if int(i) >= 5:
low += 1
return ((low >= min) and (low <= max))
def tens(comb, figures = default_tens):
"""This is for filtering the limits in each tens"""
tens_count = [0, 0, 0, 0, 0]
for i in comb[0]:
tens_count[int(i) / 10] += 1
for i in range(0,5):
if ((tens_count[i] < figures[i][0]) or (tens_count[i] > figures[i][1])):
return False
return True