def get_spesific_values(a_list, key): temp = [] for d in a_list: temp.append(d['attributes'][key]) return temp for i in range(len(candidates_attr)): current_salary = candidates_attr[i]['attributes']['salary'] current_gpa = candidates_attr[i]['attributes']['gpa'] current_dependant = candidates_attr[i]['attributes']['dependant'] salary_normalized = normalizator.normalize_salary(get_spesific_values(candidates_attr, 'salary'), current_salary) gpa_normalized = normalizator.normalize_gpa(get_spesific_values(candidates_attr, 'gpa'), current_gpa) dependant_normalized = normalizator.normalize_dependant(get_spesific_values(candidates_attr, 'dependant'), current_dependant) candidates_attr_normalized.append([candidates_attr[i]['id'],salary_normalized, gpa_normalized, dependant_normalized]) # Create a simple weight # example, salary weight is 50%, gpa is 25% and dependant is 25% role = [0.5, 0.25, 0.25] results = [] accept = False for i in range(len(candidates_attr_normalized)): temp_result = 0 for g in range(len(candidates_attr_normalized[i])): if g != 0: accept = True