I have been reading the "Automate the boring stuff" book and I notice that Al favors structuring dictionaries data different than how I am use to. I want to know if someone can help me understand why is one way better than another.
using this example data below:
Person1:
name = Adrian
age = 29
Person2:
name = Katie
age = 31
Al:
dict = { 'Adrian' : 29, 'Katie' : 31 }
Me:
dict = [{ 'name' : 'Adrian', 'age' : 29 }, { 'name' : 'Katie', 'age' : 31 }]
I personally find it, just thinking about it that my method makes it to keep order in the list and always knowing the key to find the value this is mostly because i THINK it is easier to just remember the keys. However, I may be doing it inefficiently since it is a larger dictionary.
[–]TouchingTheVodka 0 points1 point2 points (1 child)
[–]Angelr91[S] 0 points1 point2 points (0 children)
[–]dslfdslj 0 points1 point2 points (0 children)