{"id":16352,"date":"2021-07-09T19:23:07","date_gmt":"2021-07-09T13:53:07","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=16352"},"modified":"2021-07-12T10:55:40","modified_gmt":"2021-07-12T05:25:40","slug":"python-create-a-dictionary-in-the-loop-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/","title":{"rendered":"Python create a dictionary in the loop | Example code"},"content":{"rendered":"\n<p>You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example create a dictionary in the loop in Python<\/strong><\/h2>\n\n\n\n<p>Simple python example code:-<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Example 1:<\/strong> Assign key from zero.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>list1 = &#91;102, 232, 424]\r\ncount = 0\r\nd = {}  # Empty dictionary to add values into\r\n\r\nfor i in list1:\r\n    d&#91;count] = i\r\n    count += 1\r\n\r\nprint(d)\r<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"178\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg?resize=473%2C178&#038;ssl=1\" alt=\"\" class=\"wp-image-16366\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Example 2: <\/strong>Using 2 lists for key and values<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dicts = {}\r\n\r\nkeys = &#91;10, 12, 14, 16]\r\nvalues = &#91;\"A\", \"B\", \"C\", \"D\"]\r\n\r\nfor i in range(len(keys)):\r\n    dicts&#91;keys&#91;i]] = values&#91;i]\r\nprint(dicts)<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"521\" height=\"170\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-add-to-dict-in-a-loop.jpg?resize=521%2C170&#038;ssl=1\" alt=\"create a dictionary in the loop Example code\" class=\"wp-image-16357\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Example: 3<\/strong> Auto-assign key Using a range<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dicts = {}\nkeys = range(4)\nvalues = &#91;\"A\", \"B\", \"C\", \"D\"]\nfor i in keys:\n    dicts&#91;i] = values&#91;i]\nprint(dicts)<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: {0: \u2018A\u2019, 1: \u2018B\u2019, 2: \u2018C\u2019, 3: \u2018D\u2019}<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts and suggestions on this python dict topic.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers. Example create a dictionary in the loop in Python Simple python example code:- Example 1: Assign key from zero. Output: Example 2: Using 2 lists for key and values&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python create a dictionary in the loop | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30],"tags":[136,101,36],"post_series":[],"class_list":["post-16352","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-code","tag-python-dictionary","tag-python-loops"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python create a dictionary in the loop | Simple code<\/title>\n<meta name=\"description\" content=\"You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python create a dictionary in the loop | Simple code\" \/>\n<meta property=\"og:description\" content=\"You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-09T13:53:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-12T05:25:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/\",\"name\":\"Python create a dictionary in the loop | Simple code\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg\",\"datePublished\":\"2021-07-09T13:53:07+00:00\",\"dateModified\":\"2021-07-12T05:25:40+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers.\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg?fit=473%2C178&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg?fit=473%2C178&ssl=1\",\"width\":473,\"height\":178},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python create a dictionary in the loop | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python create a dictionary in the loop | Simple code","description":"You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers.","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:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/","og_locale":"en_US","og_type":"article","og_title":"Python create a dictionary in the loop | Simple code","og_description":"You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers.","og_url":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-07-09T13:53:07+00:00","article_modified_time":"2021-07-12T05:25:40+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/","name":"Python create a dictionary in the loop | Simple code","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg","datePublished":"2021-07-09T13:53:07+00:00","dateModified":"2021-07-12T05:25:40+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"You can create a dictionary in the loop in python if given an ordered list, and match up the values from the list to ordered numbers.","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg?fit=473%2C178&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-create-a-dictionary-in-the-loop.jpg?fit=473%2C178&ssl=1","width":473,"height":178},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-create-a-dictionary-in-the-loop-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Python create a dictionary in the loop | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":18767,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-to-dictionary-keys-example-code\/","url_meta":{"origin":16352,"position":0},"title":"Python convert list to dictionary keys | Example code","author":"Rohit","date":"October 27, 2021","format":false,"excerpt":"Using Dictionary Comprehension or zip() function will convert the list to dictionary keys in Python. If you have 2 lists then one list value will be a key and another one is used as the value. A single list can be used to convert a key for a dictionary but\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python convert list to dictionary keys","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-convert-list-to-dictionary-keys.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-convert-list-to-dictionary-keys.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Python-convert-list-to-dictionary-keys.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":23808,"url":"https:\/\/tutorial.eyehunts.com\/python\/map-list-to-dictionary-python-example-code\/","url_meta":{"origin":16352,"position":1},"title":"Map list to dictionary Python | Example code","author":"Rohit","date":"December 26, 2021","format":false,"excerpt":"Using the zip( ) function or dictionary comprehension you can convert the Map list to the dictionary in Python Dictionary comprehension syntax: def foo(somelist): return {x[0]:x for x in somelist} Example Map list to dictionary Python A simple example code function that will return the name of a key, and\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/Map-list-to-dictionary-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":23707,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-sum-dictionary-values-by-key-example-code\/","url_meta":{"origin":16352,"position":2},"title":"Python sum dictionary values by key | Example code","author":"Rohit","date":"December 23, 2021","format":false,"excerpt":"Use the Collection module counter function to sum dictionary values by key in Python. The counter is a sub-class that is used to count hashable objects and count each of the elements present in the container. Example sum dictionary values by key in Python A simple example code has two\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python sum dictionary values by key","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/Python-sum-dictionary-values-by-key.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":16289,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-add-to-dict-in-a-loop-adding-item-to-dictionary-within-loop-example\/","url_meta":{"origin":16352,"position":3},"title":"Python add to dict in a loop | Adding item to Dictionary within loop example","author":"Rohit","date":"July 10, 2021","format":false,"excerpt":"You can add keys and to dict in a loop in python. Add an item to a dictionary by inserting a new index key into the dictionary, then assigning it a particular value. Python add to the dictionary in a loop example Simple python code: Add key and value into\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python add to dict in a loop","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Python-add-to-dict-in-a-loop.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":8087,"url":"https:\/\/tutorial.eyehunts.com\/python\/len-python-function-to-get-length-string-array-list-tuple-dictionary\/","url_meta":{"origin":16352,"position":4},"title":"len Python | Function to get a length of string, array, list, tuple, dictionary, etc","author":"Rohit","date":"April 21, 2020","format":false,"excerpt":"A \"len Python\" is an inbuilt function and use for getting the number of items (length) in an object. A len() function can get the length of String, list (Array), tuple, dictionary, etc in Python. Syntax The syntax of len() is: len(object) Parameters Object\u00a0- a sequence (string, bytes, tuple, list,\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2020\/04\/len-Python-Function-get-length-string-array-list-tuple-dictionary-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2020\/04\/len-Python-Function-get-length-string-array-list-tuple-dictionary-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2020\/04\/len-Python-Function-get-length-string-array-list-tuple-dictionary-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2020\/04\/len-Python-Function-get-length-string-array-list-tuple-dictionary-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":23477,"url":"https:\/\/tutorial.eyehunts.com\/python\/write-a-python-program-to-multiply-all-the-items-in-a-dictionary-code\/","url_meta":{"origin":16352,"position":5},"title":"Write a Python program to multiply all the items in a dictionary | Code","author":"Rohit","date":"December 19, 2021","format":false,"excerpt":"Use for loop and variable to Write a Python program to multiply all the items in a dictionary. Python program to multiply all the items in a dictionary A simple example code multiplies all the items in a dictionary. Run a loop to traverse through the dictionary multiply each value\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Write a Python program to multiply all the items in a dictionary","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/Write-a-Python-program-to-multiply-all-the-items-in-a-dictionary.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/16352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=16352"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/16352\/revisions"}],"predecessor-version":[{"id":16370,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/16352\/revisions\/16370"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=16352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=16352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=16352"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=16352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}