-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSachet.py
37 lines (23 loc) · 855 Bytes
/
Sachet.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
import Grain
class Sachet():
def __init__(self, poids, type, grains, compo):
self.poids = poids
self.type = type
self.liste_grains = grains
self.compo_grains = compo
def is_valid(self) :
t = ["pure", "mixte"]
tValid = self.type in t
gValid = True
cValid = False
pValid = False
if(self.type in t == "pure") :
if(self.liste_grains.len != 1):
gValid = False
if(self.compo_grains == 100) :
cValid = True
if(self.poids >= 500 and self.poids <= 2000 and self.poids % 500 == 0) :
pValid = True
if (sum(self.compo_grains) == 100) :
cValid = True
return tValid and pValid and cValid and gValid