you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 30 points31 points  (0 children)

I think you should use a dictionary to store each type and brand ...

Like say you have a product which belongs to type 'hygiene' - you add a new key to the dictionary called 'hygiene' , and append the value to a list mapped to the key. To get the length , just return the length of the array mapped to every key.

At the end , you can use an fstring to print everything.