-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell_base.py
executable file
·55 lines (43 loc) · 1.22 KB
/
Cell_base.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
#!/usr/bin/python3
"""
Cell_base.py
This script modelise the behavior of the proteins inside the cell.
"""
__authors__ = ("Benoit Aliaga")
__contact__ = ("[email protected]")
__version__ = "0.1"
__date__ = "06/06/2020"
class Cell:
def __init__(self, length, width):
"""
Intialisation d'un objet
Definition des attributs avec des valeurs par defauts.
"""
self.x = length
self.y = width
def cell_area(self):
"""
Methode qui calcule la surface de la cellule.
"""
area = self.x * self.y
return area
class Protein():
def __init__(self, pos_x, pos_y):
"""
Classe qui definie une proteine
"""
self.coordx = pos_x
self.coordy = pos_y
def prot_coord(self):
"""
Methode qui calcule les coordonnees de la proteine.
"""
position = self.coordx + self.coordy
return position
# Main section
if __name__ == "__main__":
my_cell = Cell(2,1)
print("Width = ", my_cell.x, "Length = ", my_cell.y)
print("The cell area is:", my_cell.cell_area())
my_prot = Protein(4,6)
print("The coordinate of my protein is:", my_prot.prot_coord())