{"id":181,"date":"2019-02-05T06:25:15","date_gmt":"2019-02-05T06:25:15","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/python\/?p=181"},"modified":"2019-03-02T03:54:07","modified_gmt":"2019-03-02T03:54:07","slug":"12-python-dictionary","status":"publish","type":"post","link":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/","title":{"rendered":"Python &#8211; Dictionary"},"content":{"rendered":"<p>In this lesson you will learn how to use Python Dictionary. We would cover the following topics.<\/p>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li><a href=\"#t1\">Introduction to Python Dictionary<\/a><\/li>\n<li><a href=\"#t2\">Creating a Dictionary<\/a><\/li>\n<li><a href=\"#t3\">Accessing Values in a Dictionary<\/a><\/li>\n<li><a href=\"#t4\">Modifying a Dictionary<\/a><\/li>\n<li><a href=\"#t5\">Dictionary Functions in Python<\/a><\/li>\n<li><a href=\"#t6\">Dictionary Methods in Python<\/a><\/li>\n<li><a href=\"#t7\">Watch the Video<\/a><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t1\">1. Introduction to Python Dictionary<\/strong><\/h4>\n<p>A dictionary is Python store items the way a normal dictionary stores item. In each entry, you have two things: a key and a value. That is why we say, dictionary stores key-value pairs. The key and its value is separated using color (:). Then each entry is separate from the other by a comma. Also a python dictionary is created using curly braces { }.<\/p>\n<p>While the keys in a dictionary are unique, the values are not. So key in a dictionary are immutable.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">2. Creating in a Dictionary<\/strong><\/h4>\n<p>Unlike the list and tuples, you create\u00a0 dictionary using curly braces. Then you use comma to separate each key-value pair in the dictionary.<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">student <span style=\"color: #333333;\">=<\/span> {\r\n    <span style=\"background-color: #fff0f0;\">\"name\"<\/span>: <span style=\"background-color: #fff0f0;\">\"Emily William\"<\/span>,\r\n    <span style=\"background-color: #fff0f0;\">\"Location\"<\/span>: <span style=\"background-color: #fff0f0;\">\"Nigeria\"<\/span>,\r\n    <span style=\"background-color: #fff0f0;\">\"Score\"<\/span> : <span style=\"color: #0000dd; font-weight: bold;\">89<\/span>,\r\n    <span style=\"background-color: #fff0f0;\">\"Grade\"<\/span> : <span style=\"background-color: #fff0f0;\">'A'<\/span>,\r\n    <span style=\"background-color: #fff0f0;\">\"Address\"<\/span> : <span style=\"background-color: #fff0f0;\">\"No 21 Bills Street\"<\/span>\r\n}\r\n<\/pre>\n<p>The code above creates a dictionary named student. This represents the record of a particular student.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t3\">3. Accessing Values in Dictionary<\/strong><\/h4>\n<p>How can we access values in a dictionary? Unlike lists and tuples that use indexes, dictionary uses key. So you specify the key to access the value. Let&#8217;s use a typical example of a dictionary containing the days of the week.<\/p>\n<p>This is shown below.<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">daysOfWeek <span style=\"color: #333333;\">=<\/span> {\r\n    <span style=\"color: #0000dd; font-weight: bold;\">1<\/span> : <span style=\"background-color: #fff0f0;\">\"Monday\"<\/span>,\r\n    <span style=\"color: #0000dd; font-weight: bold;\">2<\/span> : <span style=\"background-color: #fff0f0;\">\"Tuesday\"<\/span>,\r\n    <span style=\"color: #0000dd; font-weight: bold;\">3<\/span> : <span style=\"background-color: #fff0f0;\">\"Wednesday\"<\/span>,\r\n    <span style=\"color: #0000dd; font-weight: bold;\">4<\/span> : <span style=\"background-color: #fff0f0;\">\"Thursday\"<\/span>,\r\n    <span style=\"color: #0000dd; font-weight: bold;\">5<\/span> : <span style=\"background-color: #fff0f0;\">\"Friday\"<\/span>,\r\n    <span style=\"color: #0000dd; font-weight: bold;\">6<\/span> : <span style=\"background-color: #fff0f0;\">\"Saturday\"<\/span>,\r\n    <span style=\"color: #0000dd; font-weight: bold;\">7<\/span> : <span style=\"background-color: #fff0f0;\">\"Sunday\"<\/span>  \r\n}\r\n<\/pre>\n<p>To access the values (given as strings) we used the keys (given as numbers). So look at the code below. What do you think the output would be?<\/p>\n<p><!-- HTML generated using hilite.me --><span style=\"color: #007020;\">print<\/span>(<span style=\"background-color: #fff0f0;\">&#8220;Today is &#8220;<\/span> <span style=\"color: #333333;\">+<\/span> daysOfWeek[<span style=\"color: #0000dd; font-weight: bold;\">1<\/span>])<br \/>\n<span style=\"color: #007020;\">print<\/span>(<span style=\"background-color: #fff0f0;\">&#8220;Tomorrow is &#8220;<\/span> <span style=\"color: #333333;\">+<\/span> daysOfWeek[<span style=\"color: #0000dd; font-weight: bold;\">2<\/span>])<\/p>\n<p>&nbsp;<\/p>\n<p>The output would be:<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">Today <span style=\"color: #000000; font-weight: bold;\">is<\/span> Monday\r\nTomorrow <span style=\"color: #000000; font-weight: bold;\">is<\/span> Tuesday\r\n<\/pre>\n<p>Note that we can only access values using keys that exist in the dictionary. For example we cannot day daysOfWeek(8). This would result in an error because there is not 8 in the dictionary.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t4\">4. Modifying a Dictionary<\/strong><\/h4>\n<p>Remember we cannot modify the keys. We can only modify the values. These we can do in three ways:<\/p>\n<ul>\n<li>add new entry<\/li>\n<li>update the value of an entry<\/li>\n<li>delete an entry<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Add new entry<\/strong><\/p>\n<p>To add a new entry into a dictionary, you use that add method of the dictionary. So\u00a0 to add an entry Nationality and Language to the original dictionary we created, we can say:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\">student[<span style=\"background-color: #fff0f0;\">\"Nationality\"<\/span>] <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"American\"<\/span>\r\nstudent[<span style=\"background-color: #fff0f0;\">\"Language\"<\/span>] <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"English\"<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Update value of an entry<\/strong><\/p>\n<p>To update and entry you simply assign another value to the key of the entry you want to update. The following would update the name and address of the student:<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">student[<span style=\"background-color: #fff0f0;\">\"Name\"<\/span>] <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"Emily Normal William\"<\/span>\r\nstudent[<span style=\"background-color: #fff0f0;\">\"Address\"<\/span>] <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"25 Western Avenue 1104 BP\"<\/span>\r\n\r\n\r\n<\/pre>\n<p><strong>Delete an entry<\/strong><\/p>\n<p>To delete an entry from a dictionary, you use the del keyword. Example is given below:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">del<\/span> student[<span style=\"background-color: #fff0f0;\">\"Location\"<\/span>]\r\n<\/pre>\n<p>Note that the above code would delete both the key and the value.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t5\">5. Dictionary Functions in Python<\/strong><\/h4>\n<p>Python provides a number of useful functions you can use with dictionaries. These functions are given in the table below. I recommend you take some time to practice them.<\/p>\n<table class=\"table table-bordered\" align=\"center\">\n<tbody>\n<tr style=\"background-color: #f7f6f3;\">\n<th>SN.<\/th>\n<th>Function and brief description<\/th>\n<\/tr>\n<tr>\n<td class=\"ts\">1<\/td>\n<td><strong>cmp(dict1, dict2):\u00a0<\/strong>Compares elements of both dict but has been removed in Python 3.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">2<\/td>\n<td><strong>len(dict):\u00a0<\/strong>Returns the total length of the dictionary. This is the same as the number of items in the dictionary.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">3<\/td>\n<td><strong>str(dict):\u00a0<\/strong>Returns a printable string representation of\u00a0 the dictionary<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">4<\/td>\n<td><strong>type(variable):\u00a0<\/strong>Gives the type of the variable passed. If the\u00a0 passed variable is a dictionary, then it would return a dictionary type.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Python includes following dictionary method<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t6\">6. Dictionary Methods in Python<\/strong><\/h4>\n<p>Python provides a number of useful methods you can use with dictionaries. These methods are given in the table below. I recommend you take some time to practice them. The video below this page can help you.<\/p>\n<table class=\"table table-bordered\" align=\"center\">\n<tbody>\n<tr style=\"background-color: #f7f6f3;\">\n<th>SN<\/th>\n<th>Methods and brief description<\/th>\n<\/tr>\n<tr>\n<td class=\"ts\">1<\/td>\n<td><strong>dict.clear():\u00a0<\/strong>Deletes all elements of dictionary\u00a0<i>dict<\/i><\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">2<\/td>\n<td><strong>dict.copy():\u00a0<\/strong>Returns another copy of dictionary\u00a0<i>dict<\/i><\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">3<\/td>\n<td><strong>dict.fromkeys():\u00a0<\/strong>Create a new dictionary with keys from seq and values\u00a0<i>set<\/i>\u00a0to\u00a0<i>value<\/i>.<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">4<\/td>\n<td><strong>dict.get(key, default=None):\u00a0<\/strong>For the given\u00a0<i>key<\/i>\u00a0key, returns value or default if key not in dictionary<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">5<\/td>\n<td><strong>dict.has_key(key):\u00a0<\/strong>Returns\u00a0<i>true<\/i>\u00a0if key in dictionary\u00a0<i>dict. Returns false if otherwise<\/i><\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">6<\/td>\n<td><strong>dict.items():\u00a0<\/strong>Returns a list of the entries in a dictionary as\u00a0(key, value) tuple pairs<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">7<\/td>\n<td><strong>dict.keys():\u00a0<\/strong>Returns list of all the dictionary dict&#8217;s keys<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">8<\/td>\n<td><strong>dict.setdefault(key, default=None):\u00a0<\/strong>Similar to get(), but will set dict[key]=default if\u00a0<i>key<\/i>\u00a0is not already in dict<\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">9<\/td>\n<td><strong>dict.update(dict2):\u00a0<\/strong>Adds dictionary\u00a0<i>dict2<\/i>&#8216;s key-values pairs to\u00a0<i>dict<\/i><\/td>\n<\/tr>\n<tr>\n<td class=\"ts\">10<\/td>\n<td><strong>dict.values():\u00a0<\/strong>Returns list of dictionary\u00a0<i>dict<\/i>&#8216;s values<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><strong id=\"t7\">7. Watch the Video<\/strong><\/h4>\n<p><iframe loading=\"lazy\" width=\"100%\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/uXX8fI1zZyo\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this lesson you will learn how to use Python Dictionary. We would cover the following topics. Introduction to Python Dictionary Creating a Dictionary Accessing &hellip; <\/p>\n","protected":false},"author":395,"featured_media":182,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[11],"class_list":["post-181","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-tutorials","tag-python-dictionary"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python - Dictionary - Python Tutorials<\/title>\n<meta name=\"description\" content=\"In this lesson you will learn how to use Dictionary in Python. You will learn how to create a dictionary and add entries to the dictionary.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python - Dictionary - Python Tutorials\" \/>\n<meta property=\"og:description\" content=\"In this lesson you will learn how to use Dictionary in Python. You will learn how to create a dictionary and add entries to the dictionary.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-05T06:25:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-02T03:54:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/02\/Dictionary-in-Python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1005\" \/>\n\t<meta property=\"og:image:height\" content=\"574\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"headline\":\"Python &#8211; Dictionary\",\"datePublished\":\"2019-02-05T06:25:15+00:00\",\"dateModified\":\"2019-03-02T03:54:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/\"},\"wordCount\":741,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/02\\\/Dictionary-in-Python.jpg\",\"keywords\":[\"Python Dictionary\"],\"articleSection\":[\"Python Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/\",\"name\":\"Python - Dictionary - Python Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/02\\\/Dictionary-in-Python.jpg\",\"datePublished\":\"2019-02-05T06:25:15+00:00\",\"dateModified\":\"2019-03-02T03:54:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"description\":\"In this lesson you will learn how to use Dictionary in Python. You will learn how to create a dictionary and add entries to the dictionary.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/02\\\/Dictionary-in-Python.jpg\",\"contentUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/02\\\/Dictionary-in-Python.jpg\",\"width\":1005,\"height\":574,\"caption\":\"Dictionary in Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/12-python-dictionary\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python &#8211; Dictionary\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/\",\"name\":\"Python Tutorials\",\"description\":\"Python Tutorial for Programming and Data Science\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/author\\\/kindsonthegenius-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python - Dictionary - Python Tutorials","description":"In this lesson you will learn how to use Dictionary in Python. You will learn how to create a dictionary and add entries to the dictionary.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/","og_locale":"en_US","og_type":"article","og_title":"Python - Dictionary - Python Tutorials","og_description":"In this lesson you will learn how to use Dictionary in Python. You will learn how to create a dictionary and add entries to the dictionary.","og_url":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/","og_site_name":"Python Tutorials","article_published_time":"2019-02-05T06:25:15+00:00","article_modified_time":"2019-03-02T03:54:07+00:00","og_image":[{"width":1005,"height":574,"url":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/02\/Dictionary-in-Python.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#article","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"headline":"Python &#8211; Dictionary","datePublished":"2019-02-05T06:25:15+00:00","dateModified":"2019-03-02T03:54:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/"},"wordCount":741,"commentCount":1,"image":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/02\/Dictionary-in-Python.jpg","keywords":["Python Dictionary"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/","url":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/","name":"Python - Dictionary - Python Tutorials","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#primaryimage"},"image":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/02\/Dictionary-in-Python.jpg","datePublished":"2019-02-05T06:25:15+00:00","dateModified":"2019-03-02T03:54:07+00:00","author":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"description":"In this lesson you will learn how to use Dictionary in Python. You will learn how to create a dictionary and add entries to the dictionary.","breadcrumb":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#primaryimage","url":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/02\/Dictionary-in-Python.jpg","contentUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/02\/Dictionary-in-Python.jpg","width":1005,"height":574,"caption":"Dictionary in Python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.kindsonthegenius.com\/python\/12-python-dictionary\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kindsonthegenius.com\/python\/"},{"@type":"ListItem","position":2,"name":"Python &#8211; Dictionary"}]},{"@type":"WebSite","@id":"https:\/\/www.kindsonthegenius.com\/python\/#website","url":"https:\/\/www.kindsonthegenius.com\/python\/","name":"Python Tutorials","description":"Python Tutorial for Programming and Data Science","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kindsonthegenius.com\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/www.kindsonthegenius.com\/python\/author\/kindsonthegenius-2\/"}]}},"_links":{"self":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/users\/395"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":3,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":200,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/181\/revisions\/200"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/media\/182"}],"wp:attachment":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/tags?post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}