I don’t want to use python functions to calculate but I want to implement a function myself. The problem comes when the chain is very long. The program starts to take about 5 minutes.
Advertisement
Answer
Why don’t you use len()?
I think what you’re trying to do is just len('holaaaaaa') and I don’t think that it can be more optimized than that.
if you want to implement the function your self then you cand do:
def StringLenght(string):
return len(string)
