Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #length #list #len #function
ADD COMMENT
Topic
Name
9+2 =