{"id":2656,"date":"2019-07-17T11:03:33","date_gmt":"2019-07-17T11:03:33","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=2656"},"modified":"2024-03-26T07:20:30","modified_gmt":"2024-03-26T07:20:30","slug":"python-dictionary-tutorial-for-beginners","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/","title":{"rendered":"Python Dictionary Tutorial for Beginners"},"content":{"rendered":"<h1>Python Dictionary Tutorial for Beginners<\/h1>\n<p>Welcome to the world of <a href=\"https:\/\/prwatech.in\/python-training-institute-in-bangalore\/\">Python<\/a> Dictionary Tutorial. Are you the one who is looking forward to knowing the <strong>Python Dictionary Tutorial<\/strong>? Or the one who is very keen to explore the Python Dictionary with Examples that are available? Then you\u2019ve landed on the Right path which provides the standard information of Python Dictionary.<\/p>\n<p>Here, we will learn about Dictionary in <a href=\"https:\/\/www.youtube.com\/watch?v=QjYfZk6IQCc&amp;t=4s\" target=\"_blank\" rel=\"noopener noreferrer\">Python Programming language<\/a> with examples and its different methods. Dictionary in Python Programming language is a special type of variable that includes a pair of items, keys, values an unordered collection of items. Do you want to know about Introduction to Dictionaries in Python with examples, then just follow the below mentioned <strong>Python Dictionary tutorial for Beginners<\/strong> from <a href=\"https:\/\/prwatech.com\/\">Prwatech<\/a> and take advanced <a href=\"https:\/\/prwatech.in\/python-training-institute-in-bangalore\/\">Python training<\/a> like a Pro from today itself under 10+ years of hands-on experienced Professionals.<\/p>\n<h2>Introduction to Dictionaries in Python<\/h2>\n<p>A dictionary in Python Programming Language is a collection of unordered, immutable, indexed having key-value pair kind of elements enclosed by curly braces.<\/p>\n<h3>Python Dictionary Examples<\/h3>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<\/p>\n<p>You can access an element of a dictionary by referring to its key name, inside square brackets.<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<\/p>\n<p>print(c[2])<br \/>\nYou can change the v<\/p>\n<p>alue of a specific element by referring to its key name:<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nc[1] : \u201cww\u201d<br \/>\nprint(c)<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/QjYfZk6IQCc\" width=\"850\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>You can traverse through a dictionary using for loop<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nfor x in c:<br \/>\nprint(x)<\/p>\n<h2><\/h2>\n<h2>Python Dictionary Methods<\/h2>\n<h3><strong>get():<\/strong><\/h3>\n<p>It is used to get the value from the key in a dictionary.<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nprint(c.get(2)<\/p>\n<h3>values():<\/h3>\n<p>It is used to print all the values from the dictionary.<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nfor x in c.values()<br \/>\nprint(x)<\/p>\n<h3>items():<\/h3>\n<p>It is used to traverse through the dictionary to print both key and values together.<\/p>\n<p>Ex) \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nfor x,y in c.items():<br \/>\nprint(c[2])<\/p>\n<h3>len():<\/h3>\n<p>It is used to determine the total number of elements in the dictionary.<\/p>\n<p><strong>Ex) \u00a0<\/strong>\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nprint(len(c))<\/p>\n<h3>pop():<\/h3>\n<p>It is used to delete a value with the specified key in a dictionary.<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nprint(c.pop(2))<\/p>\n<h3>popitem():<\/h3>\n<p>It is to delete the last inserted element from a dictionary.<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nprint(c.popitem())<\/p>\n<h3>del():<\/h3>\n<p>It is to delete an entire dictionary.<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nc.del()<\/p>\n<h3>copy():<\/h3>\n<p>It is to create a copy of a dictionary.<\/p>\n<p><strong>Ex)<\/strong> \u00a0\u00a0 c = { 1: \u201caa\u201d, 2: \u201cbba\u201d, 3: \u201cab\u201d, 4: \u201cba\u201d}<br \/>\nx=c.copy()<br \/>\nprint(x).<\/p>\n<p>We hope you understand Python Dictionary Tutorial for Beginner&#8217;s concepts. Get success in your career as a <a href=\"https:\/\/prwatech.in\/python-training-institute-in-bangalore\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python Developer<\/a> by being a part of the <a href=\"https:\/\/prwatech.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Prwatech<\/a>, India&#8217;s leading <a href=\"https:\/\/prwatech.in\/python-training-institute-in-bangalore\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python training institute in Bangalore<\/a>.<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/8dND-vrDfrs\" width=\"650\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Dictionary Tutorial for Beginners Welcome to the world of Python Dictionary Tutorial. Are you the one who is looking forward to knowing the Python Dictionary Tutorial? Or the one who is very keen to explore the Python Dictionary with Examples that are available? Then you\u2019ve landed on the Right path which provides the standard [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3422,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,1671],"tags":[76],"class_list":["post-2656","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-python-data-types","tag-python-dictionary-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Dictionary Tutorial for Beginners | Python Dictionary Methods<\/title>\n<meta name=\"description\" content=\"Explore Python Dictionary Tutorial for Beginners concepts &amp; learn introduction to dictionaries in Python with Examples and Dictionary methods from Prwatech\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Dictionary Tutorial for Beginners | Python Dictionary Methods\" \/>\n<meta property=\"og:description\" content=\"Explore Python Dictionary Tutorial for Beginners concepts &amp; learn introduction to dictionaries in Python with Examples and Dictionary methods from Prwatech\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-17T11:03:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-26T07:20:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"550\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/\",\"url\":\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/\",\"name\":\"Python Dictionary Tutorial for Beginners | Python Dictionary Methods\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg\",\"datePublished\":\"2019-07-17T11:03:33+00:00\",\"dateModified\":\"2024-03-26T07:20:30+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Explore Python Dictionary Tutorial for Beginners concepts & learn introduction to dictionaries in Python with Examples and Dictionary methods from Prwatech\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg\",\"width\":960,\"height\":550,\"caption\":\"Python Dictionary Tutorial\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Dictionary Tutorial for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Dictionary Tutorial for Beginners | Python Dictionary Methods","description":"Explore Python Dictionary Tutorial for Beginners concepts & learn introduction to dictionaries in Python with Examples and Dictionary methods from Prwatech","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Python Dictionary Tutorial for Beginners | Python Dictionary Methods","og_description":"Explore Python Dictionary Tutorial for Beginners concepts & learn introduction to dictionaries in Python with Examples and Dictionary methods from Prwatech","og_url":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2019-07-17T11:03:33+00:00","article_modified_time":"2024-03-26T07:20:30+00:00","og_image":[{"width":960,"height":550,"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg","type":"image\/jpeg"}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/","url":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/","name":"Python Dictionary Tutorial for Beginners | Python Dictionary Methods","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg","datePublished":"2019-07-17T11:03:33+00:00","dateModified":"2024-03-26T07:20:30+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Explore Python Dictionary Tutorial for Beginners concepts & learn introduction to dictionaries in Python with Examples and Dictionary methods from Prwatech","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Python-Dictionary-Tutorial.jpg","width":960,"height":550,"caption":"Python Dictionary Tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/python\/python-data-types\/python-dictionary-tutorial-for-beginners\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Python Dictionary Tutorial for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=2656"}],"version-history":[{"count":8,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2656\/revisions"}],"predecessor-version":[{"id":11103,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2656\/revisions\/11103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media\/3422"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=2656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=2656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=2656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}