Question

max() for a dictionary

Posted January 12, 2021 70 views
Python

I’m not a programmer, but does a dictionary in which all its elements have the same key make a lot of sense?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

Frankly speaking, that is not recommended for the security reasons. In python, if we want a dictionary in which one key has multiple values, then we need to associate an object with each key as value. This value object should be capable of having various values inside it. We can either use a tuple or a list as a value in the dictionary to associate multiple values with a key.

Can you elaborate a bit more on your use case?

Hope this helps!

Cheers,
Sri Charan

Submit an Answer