Feb-26-2020, 10:15 AM
Example with dictionaries:
employeList = { { "name": "susan", "nationality": "netherland", "overallCost": None }, ... } # resolve overall cost for susan employeList[0]["overallCost"] = resolveOverallCost(employeList[0]) workWithEmployeList()Example with yaml:
# employe.yml - name: susan nationality: netherland ... # python script class employeObject: overallCost = None def __init__(self, name, nationality): self.name = name self.nationarlity = nationality self.resolveOverallCost() def resolveOverallCost(self): ... self.overallCost = calculatedValue open(yamlfile): employeList = readYamlFile() for employe in employeList: emloyeObjectList.append(employeObject(employe["name], emplaye["nationality"]) workWithEmployeObjectList()