How to convert Input to Output ?
Input : mat=[[3, 37],[1, 41],[2, 37],[5, 41],[4, 35]]
Output: mat={37:[3,2],41:[1,5],35:[4]}
I have tried below code :
dic={}
x=[]
for i in mat:
dic[i[1]]=list()
dic[i[1]]=i[0]
Got This answer : {37: 2, 41: 5, 35: 4}