{"id":23855,"date":"2021-10-05T20:29:01","date_gmt":"2021-10-05T14:59:01","guid":{"rendered":"https:\/\/python-programs.com\/?p=23855"},"modified":"2021-11-22T18:33:25","modified_gmt":"2021-11-22T13:03:25","slug":"python-program-for-dictionary-items-function","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-dictionary-items-function\/","title":{"rendered":"Python Program for Dictionary items() Function"},"content":{"rendered":"

Dictionary in python :<\/strong><\/p>\n

A dictionary is a set of elements that have key-value pairs. The values in the elements are accessed using the element\u2019s keys.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given dictionary = {'hello': 100, 'this': 200, 'is': 300, 'btechgeeks': 400}<\/pre>\n

Output:<\/strong><\/p>\n

The above given dictionary is :\r\n{'hello': 100, 'this': 200, 'is': 300, 'btechgeeks': 400}\r\nThe above given dictionary items are :\r\ndict_items([('hello', 100), ('this', 200), ('is', 300), ('btechgeeks', 400)])\r\nThe above given new dictionary is :\r\n{}\r\nThe above given New empty dictionary items are :\r\ndict_items([])<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given dictionary = {'good': '1', 'morning': '3', 'this': '5', 'is': '7', 'btechgeeks': '9'}<\/pre>\n

Output:<\/strong><\/p>\n

The above given dictionary is :\r\n{'good': '1', 'morning': '3', 'this': '5', 'is': '7', 'btechgeeks': '9'}\r\nThe above given dictionary items are :\r\ndict_items([('good', '1'), ('morning', '3'), ('this', '5'), ('is', '7'), ('btechgeeks', '9')])\r\nThe above given new dictionary is :\r\n{}\r\nThe above given New empty dictionary items are :\r\ndict_items([])<\/pre>\n

Program for Dictionary items() Function in Python<\/h2>\n