When storing related data should I use a list or a dictionary?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jujumumu

If I have like the player name, level, experience should I store it in a list or dictionary. Like [‘Bob’, 5, 87] or {‘player name’ : ‘Bob’, ‘level’ : 5, ‘experience’ : 87}. Which one is better?

:bust_in_silhouette: Reply From: Eric Ellingson

Of course, it always depends on the situation, but in general (at least for the way it sounds like you’ll be using it), a Dictionary would be the best option here. This way you can put the values in properties that have names that make sense, and you don’t have to remember or care about the order that you add or retrieve values.

Thanks, I will try it. Using lists are not really working for me.

jujumumu | 2019-11-06 02:50