How to group list of dictionary as list of list of dictionary based on multiple key elements(gender & class)?
input = [{'name':'tom','roll_no':1234,'gender':'male','class':1},
{'name':'sam','roll_no':1212,'gender':'male','class':1},
{'name':'kavi','roll_no':1235,'gender':'female','class':2},
{'name':'maha','roll_no':1211,'gender':'female','class':2}]
expected_output =[[
{'name':'tom','roll_no':1234,'gender':'male','class':1},
{'name':'sam','roll_no':1212,'gender':'male','class':1}],
[{'name':'kavi','roll_no':1235,'gender':'female','class':2},
{'name':'maha','roll_no':1211,'gender':'female','class':2}]
Output