Oct-26-2020, 01:28 PM
(Oct-26-2020, 09:38 AM)Askic Wrote: I'd do something like this:
dict1 = { "key1": ["a", "b", "c"], "key2": ["x", "y", "z"] } count = 0 for j in dict1.values(): count += len(j) print(count)Or the way you started:
count = 0 for i in dict1: print("I will go to", i, "and i will buy:", dict1[i]) count += len(dict1[i]) print(count)
Thanks, that was exactly what I was looking for. I am sorry if I did not express myself clearly, I meant to specifically count these six elements (a, b, c, x, y, z)