Can anyone tell me how can I get the length of a string without using the len() function or any string methods. Please anyone tell me as I\'m tapping my head ma
len()
Not very efficient but very concise:
def string_length(s): if s == '': return 0 return 1 + string_length(s[1:])