{"id":39048,"date":"2016-11-23T09:25:22","date_gmt":"2016-11-23T15:25:22","guid":{"rendered":"http:\/\/a00344371.wordpress.com\/?p=356"},"modified":"2016-11-23T09:25:22","modified_gmt":"2016-11-23T15:25:22","slug":"creation-and-use-of-dictionaries","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/creation-and-use-of-dictionaries\/","title":{"rendered":"Creation and use of dictionaries"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/a00344371.wordpress.com\/2016\/11\/23\/creation-and-use-of-dictionaries\/\"><a href=\"https:\/\/a00344371.wordpress.com\">Programming Fundaments<\/a><\/a><\/em><br \/><\/p>\n<p>A Dictionary \u00a0is a way to store data just like a list, but instead of using only numbers to get the data, you can use almost anything. This lets you treat a dictionary like it&#8217;s a database for storing and organizing data any kind of data:<\/p>\n<pre><span class=\"gp\">&gt;&gt;&gt; <\/span><span class=\"n\">stuff<\/span> <span class=\"o\">=<\/span> <span class=\"p\">{<\/span><span class=\"s1\">'name'<\/span><span class=\"p\">:<\/span> <span class=\"s1\">'Zed'<\/span><span class=\"p\">,<\/span> <span class=\"s1\">'age'<\/span><span class=\"p\">:<\/span> <span class=\"mi\">39<\/span><span class=\"p\">,<\/span> <span class=\"s1\">'height'<\/span><span class=\"p\">:<\/span> <span class=\"mi\">6<\/span> <span class=\"o\">*<\/span> <span class=\"mi\">12<\/span> <span class=\"o\">+<\/span> <span class=\"mi\">2<\/span><span class=\"p\">}<\/span>\n<span class=\"gp\">&gt;&gt;&gt; <\/span><span class=\"k\">print<\/span> <span class=\"n\">stuff<\/span><span class=\"p\">[<\/span><span class=\"s1\">'name'<\/span><span class=\"p\">]<\/span>\n<span class=\"go\">Zed<\/span>\n<span class=\"gp\">&gt;&gt;&gt; <\/span><span class=\"k\">print<\/span> <span class=\"n\">stuff<\/span><span class=\"p\">[<\/span><span class=\"s1\">'age'<\/span><span class=\"p\">]<\/span>\n<span class=\"go\">39<\/span>\n<span class=\"gp\">&gt;&gt;&gt; <\/span><span class=\"k\">print<\/span> <span class=\"n\">stuff<\/span><span class=\"p\">[<\/span><span class=\"s1\">'height'<\/span><span class=\"p\">]<\/span>\n<span class=\"go\">74<\/span>\n<span class=\"gp\">&gt;&gt;&gt; <\/span><span class=\"n\">stuff<\/span><span class=\"p\">[<\/span><span class=\"s1\">'city'<\/span><span class=\"p\">]<\/span> <span class=\"o\">=<\/span> <span class=\"s2\">\"San Francisco\"<\/span>\n<span class=\"gp\">&gt;&gt;&gt; <\/span><span class=\"k\">print<\/span> <span class=\"n\">stuff<\/span><span class=\"p\">[<\/span><span class=\"s1\">'city'<\/span><span class=\"p\">]<\/span>\n<span class=\"go\">San Francisco<\/span><\/pre>\n<p>And that&#8217;s it. It is just really another kind of list, and a little bit simple once you get the hang of it<\/p>\n<p>Examples and more at:\u00a0https:\/\/learnpythonthehardway.org\/book\/ex39.html<\/p>\n<p>&nbsp;<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/a00344371.wordpress.com\/356\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/a00344371.wordpress.com\/356\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=a00344371.wordpress.com&#038;blog=115285426&%23038;post=356&%23038;subd=a00344371&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Programming Fundaments A Dictionary \u00a0is a way to store data just like a list, but instead of using only numbers to get the data, you can use almost anything. This lets you treat a dictionary like it&#8217;s a database for storing and organizing data any kind of data: &gt;&gt;&gt; stuff = {&#8216;name&#8217;: &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/creation-and-use-of-dictionaries\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creation and use of dictionaries<\/span><\/a><\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[37,24,33],"class_list":["post-39048","post","type-post","status-publish","format-standard","hentry","category-blogs","category-syndicated","tag-programming","tag-python","tag-tc101"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=39048"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39048\/revisions"}],"predecessor-version":[{"id":42141,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39048\/revisions\/42141"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=39048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=39048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=39048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}