I wanted to convert this list of tuples into the dictionary. I am trying to convert into a dictionary. I can only convert into a dictionary if there is only one value. but I have two values in it. I will demonstrate with more details below:
`List of tuples: [('Samsung', 'Handphone',10), ('Samsung', 'Handphone',-1),
('Samsung','Tablet',10),('Sony','Handphone',100)]`
As you can see above, I am trying to identify 'Samsung' as the key and 'Handphone' and '10' as the values with respect to the key.
My desired output would be:
`Output: {'Sony': ['Handphone',100], 'Samsung': ['Tablet',10,'Handphone', 9]}`
In the above, the item 'handphone' and 'tablet' are groups according to the key values which in my case are Sony and Samsung. The quantity of the item is added/subtracted if they belong to the same item and same key (Samsung or Sony).
I would appreciate any suggestions and ideas that you guys have in order to achieve the above output. I ran out of ideas. Thank you.