About 9,350,000 results
Open links in new tab
  1. Get Length of a List in Python Without Using Len()

    Jan 29, 2024 · In this article, we will explore different methods to find the length of a string without using the len() function in Python. We will look at several techniques like loops, recursion, and …

  2. python - alternative for range and len functions - Stack Overflow

    Apr 25, 2017 · How may I rewrite this without using range & len or any other inbuilt function? PS: str_data was used as instance variable of type list in init earlier. no built in functions to be used …

  3. Write your own len () in Python - GeeksforGeeks

    Apr 19, 2023 · The method len() returns the number of elements in the list or length of the string depending upon the argument you are passing. How to implement without using len(): …

  4. python - String length without len function - Stack Overflow

    Nov 15, 2012 · Here's a method which isn't using neither len nor iteration: >>> a = 'a' * 200000 >>> a.rindex(a[-1]) + 1 200000 To make it work for lists, which don't have rindex, use: >>> a = …

  5. Finding length of list without using the 'len' function in python

    Mar 21, 2015 · In my High school assignment part of it is to make a function that will find the average number in a list of floating points. We can't use len and such so something like …

  6. What can I use instead of Len in Python? – Quick-Advisors.com

    Apr 12, 2019 · What can I use instead of Len in Python? How to implement without using len(): Take input and pass the string/list into a function which return its length. Initialize a count …

  7. How to write code that does the same function as len() but can't use

    Mar 8, 2017 · One of the functions we have to create is len (), but I have no idea how to do it without using len (). Can anybody give me any pointers? It would be greatly appreciated. What …

  8. Python len() Function - W3Schools

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

  9. 5 Best Ways to Calculate the Length of a String in Python Without Using ...

    Mar 6, 2024 · Problem Formulation: Calculating the length of a string in Python is a basic task that’s commonly done using the built-in len() function. But what if you need to find out the …

  10. Fix TypeError: 'function' has no len() in Python - PyTutorial

    Apr 9, 2025 · TypeError: object of type 'function' has no len() How To Solve The Error. The solution is simple: call the function first, then use len() on its return value. Here's the corrected …

Refresh