-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmonth.py
executable file
·43 lines (30 loc) · 1.02 KB
/
month.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
#!/usr/bin/env python3
'''Handles the code base for month 0 of the alx programme.
'''
import sys
from base import Base
class Month(Base):
"""Defines methods to handle computation and calculation of score for a
given month. This is the base class
"""
def __init__(self, filename=None, args=None):
"""Initializer.
"""
super().__init__(filename, args)
self.month = self.args[2]
def cal_month(self):
"""calculate and compute the sccore for a given month
"""
dictionary = self.to_dict()
score = 0
t_score = 0
t_count = 0
for key, value in dictionary.items():
from project import Project
project = Project(self.month, key, self.filename, self.args)
my_project = project.cal_project()
if my_project == '--':
return '--'
score += my_project * weight # weight of the project
m_score = score / total_weight # total_weight
return (m_score)