Length of a String in Python
Following code is used to calculate length of a string using user defined length function :
Code::
def length(l):
count=0
for j in l:
count=count+1
return count
a=input("Enter String:")
c=length(a)
print("Length is :",c)
Output: