I've created a class called Emp has attributes like employee number, department number, employee type etc. I've used this class to populate a dictionary called emp_dict.
I've done a similar thing for Dept with details of the department, now I want to create a method in the department class to measure the number contractors in this class but do do this I reference the emp_dict.
def __init__(self,deptno, deptname):
self.deptno = deptno
contractor_count = 0
if qtr in ['FY14Q1A','FY14Q2A','FY14Q3A','FY14Q4A',\
for worker in self.allo[qtr].keys():
if emp_dict[worker].emptype != "R" :
contractor_count variable is never touched again. You have:
Did you mean this?
contractor_count += 1
I would also recommend using a variable name that is different from the method name, to avoid possible confusion.