{"id":17199,"date":"2021-08-26T10:43:03","date_gmt":"2021-08-26T05:13:03","guid":{"rendered":"https:\/\/python-programs.com\/?p=17199"},"modified":"2021-11-22T18:37:10","modified_gmt":"2021-11-22T13:07:10","slug":"python-program-to-print-items-from-a-list-with-specific-length","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-print-items-from-a-list-with-specific-length\/","title":{"rendered":"Python Program to Print Items from a List with Specific Length"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Add Number to each Element in a List<\/a>
\nGiven a list of a string and some specific length and the task is to print items from a List with a given Specific Length.<\/p>\n

len() function<\/strong> :<\/p>\n

The len() function is a Python built-in function.<\/p>\n

The length of a string is returned as an integer value by the len() function.<\/p>\n

The length of a string can be obtained by passing a string value as a parameter to the len() function.<\/p>\n

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

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

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

Given List = ['hello', 'btechgeeks', 'good', 'morning']\r\nGiven length = 5<\/pre>\n

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

The Items from a given List with given Specific Length : \r\nhello<\/pre>\n

Example 2:<\/strong><\/p>\n

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

Given List = ['abcd', 'efghigdh', 'kjfatr', 'ihg', 'dfth']\r\nGiven length = 4<\/pre>\n

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

The Items from a given List with given Specific Length : \r\nabcd\r\ndfth<\/pre>\n

Program to Print Items from a List with Specific Length<\/h2>\n

Below are the ways to print items from a List with a given Specific Length.<\/p>\n