Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

length of list without len function

def string_length(my_string):
    """returns the length of a string
    """
    counter = 0
    for char in my_string:
        counter += 1
    return counter

# taking user input
string_input = input("enter string :")
length = string_length(string_input)

print("length is ", length)
Comment

PREVIOUS NEXT
Code Example
Python :: how to duplicate a column pandas 
Python :: run python script inside bash script 
Python :: python regions 
Python :: how to take input in python as string and convert into integer list 
Python :: transpose of a matrix in python numpy 
Python :: adding strings together in python 
Python :: concatenate list in python 
Python :: get lastest files from directory python 
Python :: python typing list of specific values 
Python :: how to find unique sublist in list in python 
Python :: python line number 
Python :: filter dataframe with a list of index 
Python :: DIVAB Solution 
Python :: How to efficiently search for a pattern string within another bigger one, in Python? 
Python :: how many numbers greater than 100 using pytho 
Python :: error handling in python 
Python :: python linux script 
Python :: django debug toolbar urlpatterns 
Python :: create jwt token in django 
Python :: python print() 
Python :: numpy 
Python :: Get the first 4 numbers of the innermost arrays using numpy 
Python :: python flatten one liner 
Python :: dockerize django app 
Python :: gurobi get feasible solution when timelimit reached 
Python :: isprime lambda python 
Python :: py var to the power of 
Python :: multiple categories on distplot 
Python :: python selenium set textarea value 
Python :: python remove vowels from string 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =