About 26 results
Open links in new tab
  1. python - How to find length of an element in a list ... - Stack Overflow

    Oct 23, 2015 · First of all to find the length of strings you can define the function and use map function as below: def len_words(l:list): len_list = list(map(len,l)) return len_list After that you can call the max function on len_words to find the maximum value of string from list. max(len_words(l))

  2. How do I get the length of a list? - Stack Overflow

    Nov 11, 2009 · You can use the len() function to find the length of an iterable in python. my_list = [1, 2, 3, 4, 5] print(len(my_list)) # OUTPUT: 5 The len() function also works with strings:

  3. How To Find the Length of a List in Python - GeeksforGeeks

    6 days ago · There are several methods to determine the length of a list in Python. For example, consider a list l = [1, 2, 3, 4, 5], length of this list is 5 as it contains 5 elements in it. Let’s explore different methods to find the length of a list with examples.

  4. Longest String in listPython - GeeksforGeeks

    Apr 29, 2025 · Given a list of words and a positive integer K, write a Python program to find k longest words in the list in descending order of length. Examples: Input : lst = ['am', 'watermelon', 'girl', 'boy', 'colour'], K = 3 Output : ['watermelon', 'colour', 'girl'] Input : ['see', 'I', 'geek', 'on', 'brain']

  5. Using the len() Function in Python – Real Python

    Nov 16, 2024 · To get the length of a string in Python, you use len() with the string as an argument, like len("example"). To find the length of a list in Python, you pass the list to len() , like len([1, 2, 3]) .

  6. Python String Length - W3Schools

    To get the length of a string, use the len() function. The len() function returns the length of a string: a = "Hello, World!" Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, …

  7. Find Length of String in Python - GeeksforGeeks

    Dec 3, 2024 · In this article, we will learn how to find length of a string. Using the built-in function len() is the most efficient method. It returns the number of items in a container.

  8. Python len() Function: How to find length of the string - Guru99

    Aug 12, 2024 · You can use the len() to get the length of the given string, array, list, tuple, dictionary, etc. Value: the given value you want the length of. Return value a return an integer value i.e. the length of the given string, or array, or list, or collections.

  9. Python list length - Tutorial Gateway

    How to use the Python len function to find String List Length? When you use this len function on String items, it returns the total number of words in a string. Or, say, it finds the total items or words in the string.

  10. Python len() Function - W3Schools

    When the object is a string, the len() function returns the number of characters in the string.

  11. Some results have been removed