import pickle from get_data import getData def computeFraction( poi_messages, all_messages ): fraction = 0. return faraction data_dict = getData() submit_dict = {} for name in data_dict data_point = data_dict[name] print from_poi_to_this_person = data_point["from_poi_to_this_person"] to_messages = data_point["to_messages"] fraction_from_poi = computeFraction( from_poi_to_this_person, to_messages ) print fraction_from_poi data_point["fraction_from_poi"] = fraction_from_poi from_this_person_to_poi = data_point["from_this_person_to_poi"] from_messages = data_point["from_messages"] fraction_to_poi = computeFraction( from_this_person_to_poi, from_messages ) print fraction_to_poi submit_dict[name] = {"from_poi_to_this_person":fraction_from_poi, "from_this_person_to_poi":fraction_to_poi} data_point["fraction_to_poi"] = fraction_to_poi def submitDict(): return submit_dict