Your question is Grouping Objects by Property. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
In a Dassault Systèmes 3DEXPERIENCE interface, asset records may need to be displayed in groups such as design type, lifecycle state, or owner. Given an array of objects and a property name, group the objects by that property's value.
Implement group_by_property(items, property_name). The function must return a dictionary whose keys are the distinct property values and whose values are arrays of the original objects. Groups must appear in the order their keys are first encountered, and objects within each group must retain their original relative order. Do not mutate the input array or its objects.
items: an array of dictionaries. Every dictionary contains property_name.property_name: a string.None.def group_by_property(items, property_name):